On 10/28/2015 08:03 AM, Patrick R. Michaud wrote:
On Wed, Oct 28, 2015 at 03:31:09AM +0000, TS xx wrote:

Can I call the Person's constructor (in non static context),
pass the required parameter and do more things before returning?

There are two answers to this question, both of which likely deserve
a few lines in doc.perl6.org/language/faq.  Lloyd alludes to both
answers in his replies to the original post.

1.  The typical answer to this question is to use "callwith",
"callsame", "nextwith", or "nextsame".

2.  Constructors already have some special support for building
the superclass portions of an object -- see the BUILD submethod
described in Synopsis 12.

Or more to the point, read the documentation on http://doc.perl6.org/language/objects#Object_Construction

(The design documents are meant for compiler writers, doc.perl6.org is meant for users; this has consequences on the number of examples, language, information density etc.)


Reply via email to