chromatic wrote:
Suppose I extend a built-in PMC through PIR code. If certain vtable methods
can share the same implementation, it would be nice to be able to re-use a
single implementation through some mechanism other than copy and paste.
Yeah, through composition or inheritance. Manually stuffing a code PMC
into a class won't give you conflict checking, and won't set up the
necessary lookup tables for a method/vtable.
If you really want to pretend you're working with GLOBs, though, you can
introspect into the source class to retrieve the method/vtable code
object, and call add_method on the destination class to have it store
the retrieved code object.
Allison
- Re: [perl #42864] [BUG] Copying a :vtable sub also copies :... Allison Randal
-