The new :vtable pragma doesn't seem to work when used on methods
of subclasses of core classes. Here's a quick sample
(I'm also adding this test to t/pmc/parrotobject.t):
$ cat vt.pir
.sub main :main
$P0 = subclass 'Hash', 'Foo'
$P0 = subclass 'Hash', 'Bar'
$P1 = new 'Foo'
$S1 = $P1
say $S1
$P1 = new 'Bar'
$S1 = $P1
say $S1
.end
.namespace [ 'Foo' ]
.sub '__get_string' :method
.return('Hello world')
.end
.namespace [ 'Bar' ]
.sub 'get_string' :method :vtable
.return('Hello world')
.end
$ ./parrot vt.pir
Hello world
Hash[0x7d8378]
$
The two output lines should be identical ("Hello world").
Thanks!
Pm
Patrick R.Michaud (via RT) wrote:
> The new :vtable pragma doesn't seem to work when used on methods
> of subclasses of core classes. Here's a quick sample
> (I'm also adding this test to t/pmc/parrotobject.t):
>
> <snip>
>
Thanks for the good test case, which has enabled me to get a fix to this
bug. :-)
Jonathan
Excellent! Now could you get it to work in .pbc files as well? ;-)
(You may have already addressed this in other threads regarding saved
properties of subroutines, I just wanted to provide another test case
to show the current item I'm blocking on.)
$ cat vt.pir
.sub main :main
$P99 = subclass 'Hash', 'Foo'
$P99 = subclass 'Hash', 'Bar'
$P1 = new 'Foo'
$S1 = $P1
say $S1
$P1 = new 'Bar'
$S1 = $P1
say $S1
.end
.namespace [ 'Foo' ]
.sub '__get_string' :method
.return('Hello world')
.end
.namespace [ 'Bar' ]
.sub 'get_string' :method :vtable
.return('Hello world')
.end
$ ./parrot vt.pir
Hello world
Hello world
$ ./parrot -o vt.pbc --output-pbc vt.pir
$ ./parrot vt.pbc
Hello world
Hash[0x7e6be0]
$
Thanks!
Pm
> but as
> patrick later provided an example of executing a .pbc file, we'll also
> need a test for this before the ticket is closed.
I propose to close this ticket, as running the PIR and PASM test by
generating first PBC is issue of RT#41666.
The good news is that it really works:
bernhard@clou:~/devel/Parrot/repos/parrot$ ./parrot -o t.pbc
t/pmc/objects_78.pir
bernhard@clou:~/devel/Parrot/repos/parrot$ ./parrot t.pbc
Hello world
Hello world
bernhard@clou:~/devel/Parrot/repos/parrot$ ./parrot t/pmc/objects_78.pir
Hello world
Hello world
bernhard@clou:~/devel/Parrot/repos/parrot$
Any comments?
Bernhard
--
/* Bernhard.S...@gmx.de */
It seems all issues discussed in this ticket have been resolved, afaict.
Can this ticket be closed?
kjs
I vote yes. If there's another problem with this issue we should open
a new ticket.
Pm