Re: perl6 operator precedence table

2002-10-16 Thread Smylers

Larry Wall wrote:

 I was thinking more along the lines of:
 
 $x  $y
 $x ||| $y

I very much like the new suggested uses for C and C|, and making
the rarely-useful bitwise ops be longer to type.

But I'm not keen on trippled symbols: I reckon it's two easier to muddle
them with their doubled counterparts when scanning code, much easier
than it is to confuse single and doubled symbols.  The C== and C===
distinction in PHP is not easy to spot.

 But then there's ~ vs ~~~ too.

That gave me an idea.  What about using the tilde as the first character
in bitwise ops?

  $x ~ $y  # bitwise and
  $x ~| $y  # bitwise or

  ~!$x  # bitwise not

Smylers



Re: perl6 operator precedence table

2002-10-16 Thread Larry Wall

:  But then there's ~ vs ~~~ too.
: 
: That gave me an idea.  What about using the tilde as the first character
: in bitwise ops?
: 
:   $x ~ $y  # bitwise and
:   $x ~| $y  # bitwise or
: 
:   ~!$x  # bitwise not

I think I like that.  Except now we'll get things like:

x ^~|= y;

Hmm...and then there's:

$a ~? $b ~: $c

And what's bitwise xor?  I suppose it could also be ~!, but as a
binary operator.  Unfortunately, that say's that high-level logical
xor should be !!, rather than ~~.

Larry




Re: Values, Variables, Assignment

2002-10-16 Thread Larry Wall

On Tue, 15 Oct 2002, Luke Palmer wrote:
:  In Perl, variable names always begin with a special character called
:  a sigil,
: 
: Ahem, funny character.  The Camel glossary has no entry for sigil
: (though I realize it's common terminology).

Sigil is fine these days.

Larry




Re: perl6 operator precedence table

2002-10-16 Thread Smylers

Larry Wall wrote:

 :   $x ~ $y  # bitwise and
 :   $x ~| $y  # bitwise or
 : 
 :   ~!$x  # bitwise not
 
 I think I like that.  Except now we'll get things like:
 
 x ^~|= y;
 
 Hmm...and then there's:
 
 $a ~? $b ~: $c

I don't think they're too problematic.  Most people shouldn't need to
know the bitwise stuff, and for those who do a consistent prefix makes
it easier to learn.

It's rare enough to need bitwise things in Perl 5 (outside golf).  I'm
hoping that it'll be even rarer in Perl 6, as better interfaces are
designed for the things which at present require flipping individual
bits.

 And what's bitwise xor?

How about keeping caret for xor?

  $a ~^ $b  # bitwise xor
  $a ^^ $b  # logical xor

I don't think those will clash with the hyper operator.

Hmmm.  I'm not sure they look sufficiently different from each other
though.  And it does lead to:

  a ^^^ b
  a ^~^ b

The first of those contains a tripled operator (the thing I was trying
to avoid when I started this suggestion).

And both of them run the risk of looking like they're underlining
whatever's on the line above rather than being operators ...

Smylers