-
Notifications
You must be signed in to change notification settings - Fork 33
Fix range construction and length
#163
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
I think this is very nice. However, this (semantically) conflicts with PR #158. Which one to merge first? |
You don't have to follow my draft naming guidelines, but I hope you update the guidelines to suit your preferences. #139 (comment) Naming is not just a matter of taste; it is important for understanding the test codes, i.e. the expected behavior. |
I think the return type of Is there a problem with Edit: julia> length(typemin(UInt64):typemax(UInt64))
ERROR: OverflowError: 18446744073709551615 + 1 overflowed for type UInt64 |
BTW, why did you decide to specialize |
Not a problem, but array indexing in Julia is specialized for julia> length(0x00:0xff)
256 |
My idea is that the internal function (something like Edit: |
Codecov Report
@@ Coverage Diff @@
## master #163 +/- ##
=========================================
- Coverage 88.08% 87.9% -0.19%
=========================================
Files 5 5
Lines 361 372 +11
=========================================
+ Hits 318 327 +9
- Misses 43 45 +2
Continue to review full report at Codecov.
|
I'd agree except that |
TBH, I don't understand why we have to implement In any case, what I care about is the return type of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Base.length(r::AbstractUnitRange{N})
is broken.
That being said, I did not notice the problem with length
. This is a big step forward.
We don't unless we think it's useful for optimizing bounds-checking (do a
I think the specification is: return |
I eliminated the |
I'm sorry for pushing my idea on you, but it looks good to me.:+1: |
Thanks for the review! |
We had a surprising number of problems with ranges, for example: