> I haven't commented on RFC 171 because I assumed it would be shot down
> quickly by the Major Contibutors(tm), but let me just say now that I'm
> firmly in this camp:

Funny, I don't see much difference between RFC 171 and this RFC:

   171: constructor called on object creation
   189: constructor called on object blessing

Both of them suffer from involuntary method calls and no way to prevent
them.

> And I'll further add that I like Damian's RFCs on the topic, having
> essentially duplicated that functionality "by hand" myself at various
> times, and found it to be very useful and friendly.  (Although I
> used "init" instead of "SETUP" but I guess there already is an "INIT")

I like the *idea* to a lot. But I don't like the hooks being in bless.
What if you want to bless something but not call all its cascading
SETUPs? I'd much rather the hooks be somewhere else, like new builtin.
Maybe 'setup'?

     sub new { setup {}, @_ }

     sub SETUP {
          my ($self, @ctor_data) = @_;
          # initialization of object referred to by $self occurs here
     }

setup() could do the blessing + call recursive SETUPs. Just calling
bless() would retain the Perl 5 behavior.

-Nate

Reply via email to