Chaim Frenkel wrote:
>
> Why this limitation?
>
> If the lvalue is a fundemental type (whatever that is) everything works
> as if the lvalue were actually in place
> 
>         sub foo { return $a }
>         foo =~ s///;            # same as $a =~ s///;

This is not the type of lvalue sub that this RFC proposes be enabled by
default. This is a "true" or "complex" lvalue sub.

My RFC proposes that this sub:

   sub assign ($var, $val) {
       my $oldval = self->{STATE}->{$var};
       self->{STATE}->{$var} = $val if $val;
       return $oldval;
   }

Can be called as any of these forms by default:

   $old = assign($var, $val);
   $old = assign($var) = $val;
   $old = assign = $var, $val;

Make sense? This RFC doesn't address true lvalue subs, rather that
rvalue subs should be able to be used in an lvalue assignment context by
default. It is a limited but valuable syntactical tool.

-Nate

Reply via email to