RE: Perl 6 Object Construction - General Advice

2017-10-05 Thread Mark Devine
- From: Timo Paulssen [mailto:t...@wakelift.de] Sent: Thursday, October 5, 2017 13:56 To: Mark Devine <m...@markdevine.com>; perl6-users@perl.org Subject: Re: Perl 6 Object Construction - General Advice The main difference between BUILD and TWEAK is that BUILD will replace all d

Re: Perl 6 Object Construction - General Advice

2017-10-05 Thread Timo Paulssen
The main difference between BUILD and TWEAK is that BUILD will replace all default and requiredness handling, while TWEAK keeps it intact. TWEAK gets run after these aspects had their turn, so if you have an "is required" attribute that doesn't get a value passed, the BUILDALL process will throw

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Daniel Schröer
Am 30.09.2017 19:34 schrieb "Mark Devine" : My most common OC case: initialize attributes at OC time from external input that will be parsed with grammars &/| scrubbed with elaborate conditional tests. Just a shot in the dark without fully understanding the above: maybe

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:56 PM, Timo Paulssen wrote: > *method new* is useful only if you want to take positional parameters for > the .new — the default new you get from *Mu* only accepts named arguments > and passes them on as-is to *self.bless*. They then get passed to every

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 1:02 PM, yary wrote: > > I hadn't heard of TWEAK, thought that BUILD was for setting private > attributes and other tasks the object runs to build itself. > IIRC having BUILD overrides default values, so if you want to have those and still adjust things

Re: Perl 6 Object Construction - General Advice

2017-09-30 Thread Brian Duggan
On Saturday, September 30, Mark Devine wrote: > My most common OC case: initialize attributes at OC time from external > input that will be parsed with grammars &/| scrubbed with elaborate > conditional tests. I like to use assignment for simple things and TWEAK for complicated things --

Perl 6 Object Construction - General Advice

2017-09-30 Thread Mark Devine
Perl 6, I am preparing to write several classes for some Perl 6 apps I intend to craft in support of a prominent backup suite. In looking at the documentation & some of the modules published in the Perl 6 ecosystem, I’m not quite sure that I can identify the best idiomatic object construction