in reply to Re^5: Factory Pattern in Perl6
in thread Factory Pattern in Perl6
Thanks--returning self at the end does fix that branch of the code. As for why converting away from a role helped, doing that was also meant using BUILD rather than BUILDALL; apparently, you don't have to return the object at the end of BUILD.
It doesn't seem clear from the documentation that returning from BUILDALL would matter. Of these spots:
https://doc.perl6.org/language/objects#Object_Construction
None of them talk about the return value of BUILDALL, nor is it shown in the example code.
Frankly, the perl6 docs seem to spend a lot of effort on showing how clever the language can be, and not enough on explaining what's going on.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Factory Pattern in Perl6
by raiph (Deacon) on May 22, 2016 at 04:40 UTC | |
by hardburn (Abbot) on May 22, 2016 at 12:14 UTC |