Re: RFC 118 (v1) lvalue subs: parameters, explicit assignment, andwantarray() changes

[email protected] (Nathan Torkington) Sun, 27 Aug 2000 20:22:18 -0600 (MDT)
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
Damian Conway writes:
> 	pre mymethod : group("safe-coding practice") { @_ > 0 }
> 	pre mymethod : group("debugging") { print @_, "\n"; }

Using these for lvalue subs doesn't give you the behaviour you want:

  sub foo :lvalue { $foo }
  post foo { die if $foo == 5 }

  eval {
    foo() = 5;
  };

Should not set the lvalue of foo to 5.  But you can't test for
bad values until after you've made the assignment.

Nat