C
Cyrus Hall
The current Range class in ruby is quite useful, however, I was recently
trying to capture a simple algorithm and ended up needing to express
left-exclusion. This is the one feature ruby currently does not support
in its Range class.
I did some digging into 1.8.4's Range implementation and it appears
that the changes needed to support left-exclusion would be minimal.
Rather, the problem seems syntactical. Currently '..' and '...' are
used to represent right-inclusion and -exclusion, respectively. This
syntax clearly can not be extended to left-exclusion. There appears to
have been a related debate about this on ruby-talk back in Oct. 2004,
with the conclusion being, to paraphrase the entire discussion, "this is
hard, lets forget about it for now."
Has this been discussed since 2004? Would people be interested in
finding a way to get left-exclusion into the Range class? This may be
something that has been addressed in all the language work going into
1.9/2.0, and if so, any pointers would be greatly appreciated.
Ciao,
Cyrus Hall
trying to capture a simple algorithm and ended up needing to express
left-exclusion. This is the one feature ruby currently does not support
in its Range class.
I did some digging into 1.8.4's Range implementation and it appears
that the changes needed to support left-exclusion would be minimal.
Rather, the problem seems syntactical. Currently '..' and '...' are
used to represent right-inclusion and -exclusion, respectively. This
syntax clearly can not be extended to left-exclusion. There appears to
have been a related debate about this on ruby-talk back in Oct. 2004,
with the conclusion being, to paraphrase the entire discussion, "this is
hard, lets forget about it for now."
Has this been discussed since 2004? Would people be interested in
finding a way to get left-exclusion into the Range class? This may be
something that has been addressed in all the language work going into
1.9/2.0, and if so, any pointers would be greatly appreciated.
Ciao,
Cyrus Hall