On Wed, Sep 01, 2004 at 10:41:37AM -0400, Aaron Sherman wrote:
: How do you declare attribute functions? Specifically, I was thinking
: about map and what kind of object it would return, and I stumbled on a
: confusing point:
: 
:       class mapper does iterator {
:               has &.transform;
:               ...
:       }
: 
: Ok, that's fine, but what kind of accessor does it get?
: 
:       my mapper $x .= new(transform => ->{(1,2,3)});
:       $x.transform()
: 
: would imply that you're calling method transform, not invoking the
: accessor function which does not have a method signature. Would you have
: to do this:
: 
:       class mapper does iterator {
:               has Code $transform;
:               ...
:       }
:       ...
:       $x.transform.();
: 
: ?

That might not work either.  This will, though:

    ($x.transform)();

Larry

Reply via email to