You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in the parsing of exclusive ranges that is showcased by this example:
print List(1.0 ... 1.2 : 0.15) // prints [ 1 ], but should print [ 1, 1.15 ]
This happens because the exclusive range 1.0 ... 1.2 : 0.15 is converted to 1.0 .. 1.05 : 0.15 by subtracting the step from the end, which is not the right thing to do in this situation. Since this happens at parse time, it's not possible to revert this calculation in the range_count function.
If we were to instead convert all inclusive ranges to exclusive ranges by adding the step to the end, we would find that 1.0 .. 1.2 : 0.15 would be converted to 1.0 ... 1.35 : 0.15 which would print [ 1, 1.15, 1.3 ] and this is also not correct.
What we likely need is to explicitly flag whether a given range is inclusive or exclusive range at construction so that we can compute the correct number of elements in the range_count function, at which point we can convert both ranges to one or the other.
The text was updated successfully, but these errors were encountered:
Not yet - this issue arises due to how exclusive ranges are converted to inclusive ranges at parse time. I think inclusive and exclusive ranges need to be parsed separately, and only converted to one or the other at a later time, once we have full knowledge of the bounds and step size.
There is a bug in the parsing of exclusive ranges that is showcased by this example:
This happens because the exclusive range
1.0 ... 1.2 : 0.15
is converted to1.0 .. 1.05 : 0.15
by subtracting the step from the end, which is not the right thing to do in this situation. Since this happens at parse time, it's not possible to revert this calculation in therange_count
function.If we were to instead convert all inclusive ranges to exclusive ranges by adding the step to the end, we would find that
1.0 .. 1.2 : 0.15
would be converted to1.0 ... 1.35 : 0.15
which would print[ 1, 1.15, 1.3 ]
and this is also not correct.What we likely need is to explicitly flag whether a given range is inclusive or exclusive range at construction so that we can compute the correct number of elements in the
range_count
function, at which point we can convert both ranges to one or the other.The text was updated successfully, but these errors were encountered: