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
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
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.
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #109672]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org:443/rt3/Ticket/Display.html?id=109672 >
rakudo: say "aaa" ~~ m/ a [ a ]? a /;
rakudo ce5cca: OUTPUT«=> »
Which is c
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #109674]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org:443/rt3/Ticket/Display.html?id=109674 >
nom: say so 'a' ~~ /<[]>/
nom ce5cca: OUTPUT«===SORRY!===StopIteration»
std:
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
> 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