On Sat, 26 Oct 2002, Michael Lazzaro wrote:
: Date: Sat, 26 Oct 2002 10:57:01 -0700
: From: Michael Lazzaro <[EMAIL PROTECTED]>
: To: Larry Wall <[EMAIL PROTECTED]>
: Cc: Damian Conway <[EMAIL PROTECTED]>,
: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
: Subject: Re: Perl6 Operator List
:
: Larry Wall wrote:
: > : > Now I'm wondering whether these should be split into:
: > : >
: > : > +& +| +! - bitwise operations on int
: > : > +&= +|= +!=
: > : >
: > : > ~& ~| ~! - bitwise operations on str
: > : > ~&= ~|= ~!=
:
: Well, wait, these might have some promise, I think. Using the '.' for
: them is still a little non-intuitive, even though it is very bit-like.
: (We're going to be using the dot everywhere else to mean 'method', I
: don't know if it's obvious that the dot will, in this one context, mean
: something completely different?) And bitwise-string and bitwise-int are
: pretty different, and those (above) look pretty much like what they are...
And you get the C || and && for free
?& ?| ?! - bitwise operations on booleans
?&= ?|= ?!=
Yes, it's redundant to say "bitwise" and "boolean" together. :-)
But distinguishing int ops from str ops fixes the really nasty rule
in Perl 5 that says "If this value (these values) has (have) ever
been used in a string context..."
Or was it a numeric context? I can't remember. And hey, if I can't
remember...
: > Yes, but we certainly can't have !=. Another argument for not using
: > ! for xor. I guess _ is available as a kind of | laying down.
: > Can't have "x". We could use "o" as short for "one or other".
: > $either = 1 o 2;
:
: In a fever dream, I was once hoping that we could introduce 'o' or maybe
: 'c' to mean 'octal', to solve one of the most annoying things computing
: has inflicted upon me:
:
: 123 # 123, decimal
: 0123 # 123, octal. WHAT??? WHY???
: '0123' # FINE, so what's this, and why???
:
: and changing that to:
:
: 0123 # decimal
: 0b0110 # binary
: 0o123 # octal
: 0x123 # hex
:
: I know, I know, that's completely not-the-culture. Just always bugs me.
: Stupid tradition. :-P
If one were going to generalize that, one would be tempted to go the Ada
route of specifying the radix explicitly:
0123 # decimal
2:0110 # binary
8:123 # octal
16:123 # hex
256:192.168.1.0 # base 256
or some such.
Larry