On Sat, Mar 12, 2005 at 09:21:23PM +0200, Yuval Kogman wrote: : Hola, : : Object::Realize::Later and friends in perl5 get the job done, but : have many caveats. : : Will there be a mechanism to provide a way to do inplace replacement : of an object's, err, thingyness (class, data), without losing it's : identity? : : : I would like a way to transpose objects between classes in the same : instance for several reasons beside lazy loading, btw. : : I think one of the most beautiful uses is to provide protocol : handlers in a state machine style implementation, mainly for : security by simplicity.
Sounds like simple delegation to me. The delegation model in Perl 6 lets you specify which methods the delegate handles without committing to the identity or existence of the delegated object. You can probably even get an extra degree of type safety between the delegatee and delegator by using roles to pull in your interfaces. The default implementation for your role's methods could delegate, while the delegated implementation object defines them to do something real. Larry