Re: Setting private attributes during object build

2012-02-02 Thread Damian Conway
My thanks to Kris and Moritz for reassuring me that the Perl 6 initialization semantics remain sane. :-) In response to yary's original observations, the extra work required to achieve non-standard semantics doesn't seem unreasonable to me. Especially as, should one need to do it regularly, one co

Re: Setting private attributes during object build

2012-02-02 Thread yary
On 02/02/2012 07:40 AM, Damian Conway wrote: > My point was that I don't want the named arguments that BUILD can take > to be restricted to only the names of public attributes...which was, I > thought, yary's complaint when writing... Actually, that *was* one of my complaints, but I was mistaken o

Re: Setting private attributes during object build

2012-02-02 Thread yary
I think I get this better now. Currently: Default "new" passes its capture (named args) to bless. Bless passes capture (all args) to the default BUILDALL>BUILD. Default BUILD initializes only public attributes. My thought: Default "new" passes only named args matching public attributes to bless.

Re: Setting private attributes during object build

2012-02-02 Thread Damian Conway
yary wrote: >>The current approach is violating the DRY principle. When you write a >>.new method that wants to initialize private attributes, you have to >>repeat all their names again in the signature of your BUILD submethod: The other way of looking at this is that redefining the new() is abou

Re: Setting private attributes during object build

2012-02-02 Thread Martin D Kealey
> Damian: > > The whole point of having BUILD() is to separate allocation > > concerns from initialization concerns. On Thu, 2 Feb 2012, yary wrote: > And that's not so good, because it forces BUILD to be used for > initialization, and precludes initializing private attributes anywhere > else, lik