Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #40626] [BUG] :vtable fails for subclasses of core classes

4 views
Skip to first unread message

Patrick R . Michaud

unread,
Oct 31, 2006, 11:23:59 AM10/31/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #40626]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40626 >


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

Jonathan Worthington

unread,
Nov 1, 2006, 7:24:19 PM11/1/06
to perl6-i...@perl.org

Jonathan Worthington

unread,
Nov 1, 2006, 8:52:46 PM11/1/06
to perl6-i...@perl.org
(sorry for empty reply earlier)

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

Patrick R. Michaud

unread,
Nov 7, 2006, 2:34:19 PM11/7/06
to Jonathan Worthington via RT

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

Jerry Gay via RT

unread,
Feb 23, 2007, 2:16:01 PM2/23/07
to perl6-i...@perl.org
this bug seems to be resolved as of r17163. however, i'm not closing
this ticket until the example code in the original post is added as a test.
~jerry

Jerry Gay

unread,
Feb 23, 2007, 3:01:02 PM2/23/07
to parrotbug...@parrotcode.org
On 2/23/07, Klaas-Jan Stol via RT <parrotbug...@parrotcode.org> wrote:
> Attached a patch adding a test to t\pmc\objects.t using the original
> example code of this bug, so the ticket can be closed.
>
thanks for the quick turnaround. this test is perfect for the
'executed from pir test case', and will be applied shortly. 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.
~jerry

Bernhard Schmalhofer via RT

unread,
Sep 5, 2007, 3:58:33 PM9/5/07
to perl6-i...@perl.org

> thanks for the quick turnaround. this test is perfect for the
> 'executed from pir test case', and will be applied shortly.
The test case has been added in r21092.

> 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 */

Klaas-Jan Stol via RT

unread,
Nov 13, 2007, 4:10:11 PM11/13/07
to perl6-i...@perl.org

It seems all issues discussed in this ticket have been resolved, afaict.
Can this ticket be closed?

kjs

Patrick R. Michaud

unread,
Nov 13, 2007, 6:21:28 PM11/13/07
to Klaas-Jan Stol via RT, perl6-i...@perl.org

I vote yes. If there's another problem with this issue we should open
a new ticket.

Pm

0 new messages