On Wed, 9 Oct 2002, John Williams wrote:
: On Tue, 8 Oct 2002, Larry Wall wrote:
:
: > : but I think the latter is unnatural enough that it deserves parens, so I'd
: > : put 'but' above comma (and probably '='), but below just about everything
: > : else.
: >
: > Could perhaps unify with C<..>. Wouldn't hurt for it to be
: > non-associative like C<..>.
:
: 'Is' and 'but' return their left operand to allow chaining, so don't 'is'
: and 'but' need to be left associative so the following will work?
:
: 0 but true but string('zero rows affected')
It might be clearer to require the parens there to disambiguate
(0 but true) but string('zero rows affected')
from
0 but (true but string('zero rows affected'))
But you're probably right that people will expect it to just stack more
properties on the leftmost argument.
: > I'd be more inclined to unify & and | with * and +, since that's
: > exactly what they are in Boolean algebra, where 1*1 == 1. I think
: > the argument that it breaks C compatibily is weak in this case,
: > since almost everyone admits that C is broken in this respect.
:
: Good point.
:
: > Alternately, we take | and & away from bitwise ops and do something
: > more useful with them. I have been asked privately by a sight
: > impaired person to consider using | as the separator for parallel
: > streams rather than the almost invisible ; character, for instance.
: > Being a bit sight impaired myself at the moment, I have great empathy...
:
: | and & do one thing different from + and *. They impose integer context
: on their operands, rather that just numeric.
Not if you use them on strings.
: How about moving ** down to just above *? There's no precedence from C,
: and -$a**2 is a bit counter-intuitive mathematically. I'm not sure
: what the intuitive behavior should be for the other unary operators
: though.
Seems to me we once had it that way, and people complained.
: I can post a revised table if the associativity of 'but' is clarified.
I wonder if we can combine .. with but. What if .. could also be
left associative? What would 1 .. 10 .. 10 mean? Maybe:
[1,2,3,4,5,6,7,8,9,10],
[2,3,4,5,6,7,8,9,10],
[3,4,5,6,7,8,9,10],
[4,5,6,7,8,9,10],
[5,6,7,8,9,10],
[6,7,8,9,10],
[7,8,9,10],
[8,9,10],
[9,10],
[10]
Hmm. I guess 1 .. (0 ..) would then mean something like:
[],
[1],
[1,2],
[1,2,3],
[1,2,3,4],
[1,2,3,4,5],
[1,2,3,4,5,6],
[1,2,3,4,5,6,7],
[1,2,3,4,5,6,7,8],
[1,2,3,4,5,6,7,8,9],
[1,2,3,4,5,6,7,8,9,10],
...
That strikes me as potentially useful to someone.
Larry