Larry mused:
On Tue, 29 Oct 2002, David Whipp wrote:
: Larry Wall [mailto:larry@;wall.org] wrote:
: > : unary (postfix) operators:
: > : ... - [maybe] same as ..Inf [Damian votes Yes]
: > : > I wonder if we can possibly get the Rubyesque leaving out of
: > endpoints by saying something like 1..!10.
:
Of course, ..! and ..^ have the same problem. But it just seems like
it's really unlikely that someone would use a unary ! or ^ on the
endpoint term. So with 1..!$x or 1..^$x it's likely to be right if
we guess (per the longest token rule) that the operator is ..! or ..^.
The same can't be said of ..<, alas. But at least it might produce
a syntax error when it tries to parse the >.
Of course, Real Mathematicians will want [1..10) and (1..10] instead.
I kind like ..^ the best because ^ is currently read "exclusive of"
anyway, sort of...
And the arrow can be read "up to", at least on that end of it. I think
that ..^ is going to be much, much more common than ^.. will be.
Forgive me but is this syntax really necessary.
Does it buy us enough over +1 and -1?
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?
Damian