Hi! Please consider following me on twitter: @hanekomu.
2001年05月31日
Attributes II
After doing some more experiments and work with attributes, there are now two more modules on CPAN: Attribute::Util, which provides four general-purpose attributes (Memoize, Abstract, Alias, SigHandler) and Attribute::Overload, which allows you to declare a subroutine to be an overload handler for one or more operations.
I've also submitted a proposal for a talk on attributes to YAPC::Europe (yes, I know the CFP deadline is today…)
Work still continues on Exporter::Simple, another module that uses - surprise! - attributes to make life easier if you want to export variables and subroutines. Damian is about to release a new version of Attribute::Handlers and so I'm delaying the release of Exporter::Simple; there are still a few things to be implemented.
I've quit my job (it was the end of a project) to spend all summer hacking Perl (ok, I'll try to get out every now and then…), and you just get so much more done if you can work a) on what you really love to do, b) in concentration, c) without commercial pressures.
I'll start looking for another job in September, but again it'll only be to fund some more time on what's really important.
posted at: 10:40 | path: /misc | permalink | 0 comments | 0 trackbacks
2001年05月18日
Fun with Attributes
Got into attributes today. Damian's Attribute::Handlers really makes this easy. The result so far are the following three modules:
Attribute::TieClasses - attribute wrappers for CPAN Tie classes. The
following lines load in Tie::Scalar::Timeout and tie()s
$k with those options
use Attribute::TieClasses; my $k : Timeout(EXPIRES => '+2s');
Attribute::Memoize - Attribute interface to Memoize.pm
use Attribute::Memoize; sub fib :Memoize { my $n = shift; return $n if $n 2; fib($n-1) + fib($n-2); }
Attribute::Abstract - implementing abstract methods with attributes
package SomeObj; use Attribute::Abstract; sub new { ... } sub write : Abstract;
Now, if properties (in Perl 6 jargon) were modifiable at runtime, it would open the door to aspect-oriented programming. There might be a little talk at YAPC::NA and/or YAPC::Europe on that; so far there is a proof-of-concept implementation of aspects using the flexibility afforded by the debugger. More on that later.
posted at: 16:38 | path: /dev | permalink | 0 comments | 0 trackbacks