-
Notifications
You must be signed in to change notification settings - Fork 45
add Origin to specify the origin of output OffsetArray #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #147 +/- ##
==========================================
- Coverage 94.44% 93.77% -0.68%
==========================================
Files 3 3
Lines 234 257 +23
==========================================
+ Hits 221 241 +20
- Misses 13 16 +3
Continue to review full report at Codecov.
|
|
This looks great! I'm just wondering if the name |
|
The ambiguity might come from the fact that "offset" can also be a verb. I originally thought it was okay because I mean, I'm not a native speaker 😂 I'm really bad at naming. Do you have any suggestions? |
|
I'm not a native speaker either 😆 perhaps use just |
That's my main consideration for the |
|
I guess this is fine. We may add some keyword-based constructors to simplify the process. Eg. julia> OffsetArray(zeros(2,2), offsets = (2,2))
2×2 OffsetArray(::Array{Float64,2}, 3:4, 3:4) with eltype Float64 with indices 3:4×3:4:
0.0 0.0
0.0 0.0
julia> OffsetArray(zeros(2,2), origin = (2,2))
2×2 OffsetArray(::Array{Float64,2}, 2:3, 2:3) with eltype Float64 with indices 2:3×2:3:
0.0 0.0
0.0 0.0In this case we don't even need to export the types. |
Remove the |
|
I would say keep |
|
Sorry for the inaccurate question. Let me ask again about the API we're going to take. I've added both APIs in 67c13a2 for review purposes, but I'm not very satisfied with it. Here are the questions:
I feel we should only keep one of
|
|
Regarding the second point, I'll say that Regarding whether to add the keyword-based constructor at all, this is something that I don't have a strong opinion about, but I feel that the keyword-based versions does make it easier to understand what's going on without necessarily being familiar with the package. However this is a matter of taste, and given that the positional-argument version has been standardized maybe we can stick to that. In this case we'll perhaps have to export the types. On that note, I actually don't mind these not being exported. Something like this seems pretty clear to me: julia> OffsetArray(a, OffsetArrays.Origin(0,0))This also sidesteps the issue of having to prepend I'm not sure what constitutes the API: exported types or documented types? If this usage is documented, would it still not be used if the type is not exported? Regarding |
|
Edit: I'm now satisfied with the version in 57c7aa8. 😆
I feel it awkward to only define Perhaps not define both of them in this PR, and try
|
5095ce6 to
57c7aa8
Compare
57c7aa8 to
35622c2
Compare
|
The nightly test failure on macOS is not related; I've verified it locally. |
closes #132