Oh, and the thing I forgot to mention: contrary to BUILD and TWEAK, DESTROY is 
invoked by underlying backend VM. I.e. by MoarVM, or JVM, or JS because only 
the VM knows when exactly an object cease to exists.

Best regards,
Vadim Belman

> On Jul 21, 2020, at 4:53 AM, Richard Hainsworth <rnhainswo...@gmail.com> 
> wrote:
> 
> Trying to update the documentation on submethod TWEAK - there is nothing.
> 
> But the documentation should be accurate and not confusing. So some questions:
> 
> In a loop or program, things like BUILD or LEAVE or FIRST are called 
> 'phasers'.
> 
> By analogy, during the 'build' process of instantiating an object from a 
> class, two 'submethod's can be called, viz.
> 
> submethod BUILD and submethod TWEAK.
> 
> 1) Should these submethods be considered 'phasers' to be consistent with 
> other BUILD, LEAVE etc usages?
> 
> 2) What actually calls these submethods?
> 
> The documentation says 'bless' indirectly calls submethod BUILD. But the 
> documentation seems to indicate that 'bless' is not needed to create an 
> object.
> 
> So what calls the submethods?
> 
> 3) Is it correct to say that TWEAK can access all the attributes of the 
> object?
> 
> 4) How to describe the way the TWEAK of a subclass accesses attributes in the 
> parent?
> 
> eg
> 
> class A { has $.thing }
> 
> class B is A { submethod TWEAK { #do something to $.thing in A } }
> 

Reply via email to