Re: RFC 118 (v1) lvalue subs: parameters, explicit assignment, andwantarray() changes
[email protected] (Damian Conway) Thu, 24 Aug 2000 08:32:43 +1000 (EST)
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <[email protected]> |
> I would have assumed that a pre/post/invariant would not be used regularly,
> but rather under optional control. So this would lose that feature.
The option is to opt out of preconditions, not opt in.
Besides, I intend to propose an attribute that makes them un-opt-out-able:
sub new { bless {}, $_[0] }
sub x { lreturn $_[0]->{x} }
post x : mandatory { $_[0]->{x} >= 0 }
Damian