On Thu, 31 Oct 2002, Damian Conway wrote:
: Forgive me but is this syntax really necessary.
: Does it buy us enough over +1 and -1?

Well, that was my first thought, but...

:       Proposed               Now
: 
:        1..10                1..10
:           1..^10               1..9
:           1..^$x               1..$x-1
:           1^..10               2..10
:           $x^..10              $x+1..10
:           1^..^10              2..9
:           $x^..^$y             $x+1..$y-1
: 
: I mean, for what it is, I do like the syntax, but is it useful enough to
: warrant the extra cognitive load it brings with it?

I think it helps a lot as soon as you get outside the realm of
integers.  And I think it helps a lot with integers too.  It seems
like you just want 0..^$size all the time in any C-derived language.
I don't think it's just Ruby envy...

In general, for any type, how do you write

        [$min .. $max - $step : $step]
        
when you don't even necessarily have subtraction defined?  We don't know
how to do "z" - 1 in Perl 5, for instance.

Larry

Reply via email to