Front page | perl.perl6.language |
Postings from May 2005
Re: Roles and BUILD
Thread Previous
|
Thread Next
From:
Larry Wall
Date:
May 16, 2005 08:55
Subject:
Re: Roles and BUILD
On Mon, May 16, 2005 at 03:10:10PM +0000, Ingo Blechschmidt wrote:
: my MyBot $bot .= new;
: # Are IRC::Bot::JoinOnInvite::BUILD and
: # IRC::Bot::SayHelloOnJoin::BUILD called?
Yes, role BUILD submethods are magically composed into the class's
BUILD method somehow (or at least called at the appropriate time).
: And:
: my IRC::Bot $bot .= new;
: # Up to now, no BUILDs of any role is called.
: $bot does IRC::Bot::SayHelloOnJoin;
: # Is IRC::Bot::SayHelloOnJoin's BUILD called now?
Seems like a reasonable thing in general. If you're going to be
adding state to an object, it really ought to be initialized correctly
(though in this case you seem to be adding the state outside the
object itself, which is also fine).
Larry
Thread Previous
|
Thread Next