> This would change the perl5 meaning of lvalue subroutines.  Currently
   > you must have the lvalue as the last value before the return, and the
   > assignment is implicitly done by Perl.  I advocate making it explicit:
   > 
   >   # this is perl5
   >   sub foo :lvalue {
   >     $variable;             # am I rvalue or lvalue sub?  I don't know
   >   }
   >   foo = 5;         # implicitly $variable = 5
   > 
   > I would now have this as:
   > 
   >   # this is perl6
   >   sub foo :lvalue ($new) {
   >     $variable = $new;
   >   }

So how do I do:

        foo += 5;
        foo -= 5;
        foo *= 5;
        foo /= 5;
        foo %= 5;
        foo ||= 5;
        foo &= 5;
        #etc.

(which I can do now)?

I think the proposal is cute, but dead wrong -- because it solves too
specific a problem.

I intend to counter-RFC it with an even more general lvalue mechanism
than is currently available, plus a suggestion that operator= be
overloadable.

When that truck-load of tuits I ordered arrives.

Damian

Reply via email to