In pdd15oo, there seems to be an issue about using load_bytecode
to load :method subs after a class has been created.
Here's my test code. The main file is 'foo.pir':
$ cat foo.pir
.sub 'main' :main
$P0 = newclass 'Foo'
$P1 = new 'Foo'
$P1.'foo_method'()
load_bytecode 'bar.pir'
$P1 = new 'Foo'
$P1.'bar_method'()
.end
.namespace ['Foo']
.sub 'foo_method' :method
say 'foo_method'
.end
Here's 'bar.pir', which is loaded via load_bytecode:
$ cat bar.pir
.namespace ['Foo']
.sub 'bar_method' :method
say 'bar_method'
.end
When I run foo.pir, it doesn't recognize 'bar_method' as being
a valid method for Foo objects:
$ ./parrot foo.pir
foo_method
Method 'bar_method' not found
current instr.: 'main' pc 24 (foo.pir:8)
$
It works if I move the load_bytecode line above the newclass opcode.
There doesn't seem to be any difference between loading bar.pir
or a pre-compiled bar.pbc .
Pm