I wrote my first perl6 over the weekend, needing some help on #perl6.
And now after finishing some lunchtime thoughts I wanted to post here
on my main sticking point.

If one wants to set a private attribute, one must define a "submethod
BUILD". If one wants to use any argument in the constructor other than
a public attribute (positional OR named other than an attribute name),
one must define a "method new( ... )".

And if one wants to do both, then the initialization code must be
spread between "method new ( ... )" and "submethod BUILD".

One fix posited on #perl6 was a "blessall" method that would act like
"bless", but also allow setting private attributes. That would be a
solution... but... how about going all the way and allowing "bless" to
set private attributes? I wasn't looking when the decisions were made
about bless, and I can understand an argument about not letting
private attributes leak out. On the other hand, if it's OK for a new
"blessall", why not for "bless" itself instead?


Reply via email to