stevan / p5-mop-redux

A(nother) MOP for Perl 5
139 stars 36 forks source link

ordering issue with FINALIZE #107

Closed doy closed 11 years ago

doy commented 11 years ago

Currently, there is no way to modify methods in a class during FINALIZE. If you attach an event to before:FINALIZE, you miss being able to see any methods that were applied from roles, and if you attach an event to after:FINALIZE, the method has already been written into the stash (and in the future, we'd like to be able to write an optimized version into the stash that bypasses execute, if possible). How should we organize the events such that this is possible?

doy commented 11 years ago

Maybe it'd make more sense for before:FINALIZE to run after applying roles? I'm not sure.

doy commented 11 years ago

Yes, that's almost certainly the right answer. It really doesn't make a lot of sense to have a hook point where the mop isn't internally consistent. The hook points should be before and after the mop aspects have been flattened into the stash. Maybe the events shouldn't be named FINALIZE, but should be tied into the compiler part (from #112)?