Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^6: Factory Pattern in Perl6

by hardburn (Abbot)
on May 20, 2016 at 20:31 UTC ( [id://1163681]=note: print w/replies, xml ) Need Help??


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

https://doc.perl6.org/language/traps#BUILD_prevents_automatic_attribute_initialization_from_constructor_arguments

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
    Thanks for verifying the `self` fix.

    Thanks for the feedback about the BUILDALL examples. I've fixed the two documents to show and comment on the returning of `self` and to switch `nextsame` to `callsame`.

    Thanks for working through this. Hopefully the fun aspects of Perl 6 resonate more than the frustrations.

      Thanks for all your help. I do want to see perl6 take off. Just need to file off some of the rough edges :)


      "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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1163681]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found