Skip Menu |

This queue is for tickets about the UNIVERSAL-Object CPAN distribution.

Report information
The Basics
Id: 119521
Status: open
Priority: 0/
Queue: UNIVERSAL-Object

People
Owner: Nobody in particular
Requestors: haarg [...] haarg.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: __no_BUILD__ support
One aspect of the object construction protocol we've added to Moo, Class::Tiny, and soon Moose (https://github.com/moose/Moose/pull/142) is __no_BUILD__. It is a parameter passed into the constructor that signifies that BUILD subs should not be called. This is needed because when combining multiple object libraries in one inheritance chain, you end up with BUILD subs getting called multiple times, some at the wrong time. With a Moo class inheriting from a Moose class, it will pass in __no_BUILD__ when calling the superclass constructor. Moose can then avoid calling BUILD, allowing Moo to do the remaining instance population and call the BUILD subs itself. This does rely on nothing too goofy happening in BUILDARGS, but still seemed the best implementation of the idea. It seems like it would be good for UNIVERSAL::Object to support this as well, although if other libraries were reimplemented in terms of UNIVERSAL::Object it likely wouldn't be needed.
I have no issue with adding __no_BUILD__ support to UNIVERSAL::Object, I added it to the issue tracker on github (https://github.com/stevan/p5-UNIVERSAL-Object/issues/3) if you would like to track progress and/or help. - Stevan On Tue Dec 27 17:55:29 2016, haarg wrote: Show quoted text
> One aspect of the object construction protocol we've added to Moo, > Class::Tiny, and soon Moose (https://github.com/moose/Moose/pull/142) > is __no_BUILD__. It is a parameter passed into the constructor that > signifies that BUILD subs should not be called. > > This is needed because when combining multiple object libraries in one > inheritance chain, you end up with BUILD subs getting called multiple > times, some at the wrong time. > > With a Moo class inheriting from a Moose class, it will pass in > __no_BUILD__ when calling the superclass constructor. Moose can then > avoid calling BUILD, allowing Moo to do the remaining instance > population and call the BUILD subs itself. > > This does rely on nothing too goofy happening in BUILDARGS, but still > seemed the best implementation of the idea. > > It seems like it would be good for UNIVERSAL::Object to support this > as well, although if other libraries were reimplemented in terms of > UNIVERSAL::Object it likely wouldn't be needed.