This repository was archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Support BUILD #20
Copy link
Copy link
Open
Labels
Description
Have new support a user written BUILD function.
- Called after the object is created.
- It takes no arguments and returns nothing.
- The decision to call BUILD or not should be made by the mite compiler, not at runtime
- BUILD inheritance is special...
From Moose::Manual::Construction...
The interaction between multiple "BUILD" methods in an inheritance
hierarchy is different from normal Perl methods. You should never call
"$self->SUPER::BUILD", nor should you ever apply a method modifier to
"BUILD".
Moose arranges to have all of the "BUILD" methods in a hierarchy called
when an object is constructed, from parents to children. This might be
surprising at first, because it reverses the normal order of method
inheritance.
The theory behind this is that "BUILD" methods can only be used for
increasing specialization of a class's constraints, so it makes sense
to call the least specific "BUILD" method first. Also, this is how Perl
6 does it.