[perl #42865] [BUG] There's no way to set a vtable function with a Sub at runtime  # New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #42865]
# in the subject line of all future correspondence about this issue. 
# 


There's no real way to set a vtable function at runtime. It's  
possible to use the PIR compiler to eval a new function, but there's  
no way to take an existing sub and add it as a vtable function[1].

Before :vtable, this operation simply meant adding the sub to the new  
namespace under the right name. But since that's going away, we need  
a new way to do things.

I suspect we need some sort of set_vtable opcode.

     set_vtable ['Foo'; 'Bar'], 'get_string', $P0

Maybe there should be set_root_vtable and set_hll_vtable variants to  
go along with to match the set_*global opcodes.

I'm not sure how this should interact with PMCs or whether there  
should be get_*vtable opcodes. It should be easy enough to return a  
Bound_NCI PMC if the user requests a vtable function from a PMC.

[1] Technically, there is a way, but it's a bug. See RT#42864.

--
Matt Diephouse
http://matt.diephouse.com


