----- Original Message ----- 
From: "Luke Palmer" <[EMAIL PROTECTED]>
To: "Austin Hastings" <[EMAIL PROTECTED]>
Cc: "Larry Wall" <[EMAIL PROTECTED]>; "Language List" <[EMAIL PROTECTED]>
Sent: Thursday, January 22, 2004 4:28 PM
Subject: [perl] Re: Semantics of vector operations


> Austin Hastings writes:
> > How do you handle operator precedence/associativity?
> >
> > That is,
> >
> >    $a + $b + $c
> >
> > If you're going to vectorize, and combine, then you'll want to group. I
> > think making the vectorizer a grouper as well kills two birds with one
> > stone.
> >
> >   $a + >>$b + $c<<
> >
> > vs.
> >
> >   $a +<< ($b + $c)
>
> I have to agree with Larry here, the latter is much cleaner.
>
> I'm actually starting to like this proposal.  I used to shiver at the
> implementation of the old way, where people used the operator to group
> arbitrary parts of the expression.  I wouldn't even know how to parse
> that, much less interpret it when it's parsed.
>
> Now, we have a clear way to call a method on a list of values:
>
>     @list Â.method
>
> And a clear way to call a list of methods on a value:
>
>     $value. @methods
>
> It's turning out pretty nice.

   I just realized a potential flaw here.  Consider the code
        $a >>= 1;

   Will this right-shift the value of $a one bit and assign the result to $a
(the current meaning)?  Or will it assign the value 1 to each element in the
array referenced by $a (as suggested by the new syntax).  Both of these are
perfectly valid operations, and I don't think its acceptable to have the
same syntax mean both.  I'm aware that using "Â=" instead of ">>=" will
eliminate the inconsistency, but not everyone has easy access to Unicode
keyboards.

Joe Gottman


Reply via email to