On Thu, Nov 06, 2008 at 04:59:41AM -0800, Michael G Schwern wrote:
> I still say subroutine attributes are the way. That's the syntax for> attaching things to a subroutine in Perl 5. I'd make a decorate() attribute> and pass it the decorators.That's not what attributes do though, they call a class method at a random
point when the sub doesn't have a name yet and then you do a crazy dance to
try and do something useful with them.
We hates attributes, we do.
> sub incr : decorate(memoize, log($file)) {> $_[0] + 1;> }Meh. How about
memoized logged (to => $file) sub incr (Int $i) {
$i + 1;
}
?
We can certainly decorate 'method' like that. Not sure if it's possible
with sub; when rafl took over trying to make sub signatures work I kind of
forgot most of what little I'd worked out about how 'sub' is parsed in
statement form.
Better still, how about we shift off to the perl5-syntax list and stop
bothering p5p until we have something worth shoving into core? :)