Hi,

As of r15039, :vtable and :vtable("...") are now both implemented. See example code at the end of this email.

As of now, please use this new syntax. I have left in support for the old "__"-prefix lookup as plenty of old code is using it; please note that if you have a :vtable("xxx") and a "__xxx" then the first will be called, not the second.

I'll leave it to Chip and/or Allison to decide how long the deprecation cycle is for this.

Implementation wise, at the moment I'm just storing these entries in "\0VTABLE\0" sub-namespace within the class namespace, however I'm not sure I like this (feels like we got rid of one bit of namespace pollution by adding another, albeit a less noticeable one). I don't see another way to attach the VTABLE namespace to the main one, however. But that's an implementation detail - even if we change that any :vtable-using code will go on working fine.

Tests and some extra error checking code to come.

Jonathan

.sub main :main
   $P0 = newclass [ "Test" ]
   $P1 = new [ "Test" ]
   $I1 = $P1[11]
   print $I1
   print "\n"
   $S1 = $P1[11]
   print $S1
   print "\n"
.end

.namespace [ "Test" ]

.sub get_integer_keyed_int :method :vtable
   .param int key
   .return(42)
.end

.sub monkey :method :vtable("get_string_keyed_int")
   .param int key
   .return("monkey")
.end


Reply via email to