# New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #42864]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42864 >


Copying a subroutine/method that has also been marked as a :vtable  
function also copies over that :vtable information. As a result,  
it'll act as that :vtable function whether you want it to or not.

   .namespace ['Foo']

   .sub get_string :vtable
     .return('Foo')
   .end

   .namespace ['Bar']

   .namespace

   .sub main :main
       $P0 = newclass 'Foo'
       $P0 = newclass 'Bar'

       $P0 = get_hll_global ['Foo'], 'get_string'
       set_hll_global ['Bar'], 'test', $P0

       $P0 = new 'Foo'
       $S0 = $P0
       say $S0

       # this shouldn't print "Foo", but it does
       $P0 = new 'Bar'
       $S0 = $P0
       say $S0
   .end

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

Reply via email to