in reply to Re^2: [Perl 6] Any provision for a "dereferencing object"?
in thread [Perl 6] Any provision for a "dereferencing object"?
UPDATE: Oh, I see what you're up to I think. Some function you build once and applicate anwhere. I am also a little surprised your $x->$deref.
Well, that's a bit of common OO syntactical sugar: if $code contains a subref, then in
$object->$code(@args);
the corresponding sub is called as a method on $object. This is often used to implement callbacks in a way that personally I like:
$object->record( name => 'doit', callback => sub { my $caller=shift; # ... } );
|
---|
In Section
Meditations