Yes, or course it's possible, at the expense of more unreadable code.

But the zero special case doesnt make sense. And is inconsistent with
other out-of-range cases, eg (in-vector (vector) 1 1) errors

To be clear, empty traversals with valid indices would still be legal,
eg (in-vector (vector 1 2) 1 1)

On Tue, Jan 19, 2016 at 2:06 PM, Vincent St-Amour
<stamo...@eecs.northwestern.edu> wrote:
> Would it be possible to special-case `(in-vector (vector) 0 0)`
> directly, and fix the bug while keeping backwards compatibility?
>
> Vincent
>
>
> On Tue, 19 Jan 2016 12:19:12 -0600,
> Stephen Chang wrote:
>>
>> I'm fixing pr 15227 but I would like to do so in a backwards-incompatible 
>> way.
>>
>> Right now an out-of-range index is sometimes allowed as an argument to
>> in-vector, leading to the bug:
>>
>> $ racket
>> Welcome to Racket v6.4.0.4.
>> -> (for/sum ([x (in-vector (vector 10 20) 2 -1 -1)]) x)
>> SIGSEGV MAPERR si_code 1 fault on addr 0x180
>> Aborted
>>
>> From what I can tell, the out-of-range index is allowed to enable this 
>> program:
>>
>> (in-vector (vector) 0 0)
>>
>> I want to change in-vector so that the starting index is always a
>> valid vector-ref. The above program would become illegal.
>>
>> From what I gather, the above program is allowed so that in-vector
>> mimics in-range but I don't think this makes sense either if it means
>> allowing out-of-range indices for the former.
>>
>> Any objections?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to