in reply to replace object methods at runtime

Does it exist symbol table per object(instance) or only per class/package?
A symbol table only exists per class/package.

You might be interested in Object::Prototype which implements a prototype object model like Javascript has. That will allow you to implement methods on a per object basis.

Replies are listed 'Best First'.
Re^2: replace object methods at runtime
by karavelov (Monk) on Jun 24, 2008 at 13:40 UTC
    Thanks, sounds interesting this prototype objects. Quick view of the source reveals that in this manner can be defined new methods but I doubt that could be replaced already existing ones. The solution is to make some kind of dispatch table indexed by id of the object and method and than create subs in AUTOLOAD. But I really doubt that the new method could shadow the already existing method.
    For now I think to just clean the double dispatch solution that I already have.
      If you don't need something as heavy-duty as Class::Prototyped, you can use Class::Unique, which gives every instance a unique subclass whose symbol table you can tweak at will.