Skip to content
This repository was archived by the owner on Dec 7, 2022. It is now read-only.
This repository was archived by the owner on Dec 7, 2022. It is now read-only.

Support BUILD #20

@schwern

Description

@schwern

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions