Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

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

已查看 5 次
跳至第一个未读帖子

Patrick R . Michaud

未读,
2006年10月31日 11:23:592006/10/31
收件人 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

未读,
2006年11月1日 19:24:192006/11/1
收件人 perl6-i...@perl.org

Jonathan Worthington

未读,
2006年11月1日 20:52:462006/11/1
收件人 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

未读,
2006年11月7日 14:34:192006/11/7
收件人 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

未读,
2007年2月23日 14:16:012007/2/23
收件人 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

未读,
2007年2月23日 15:01:022007/2/23
收件人 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

未读,
2007年9月5日 15:58:332007/9/5
收件人 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

未读,
2007年11月13日 16:10:112007/11/13
收件人 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

未读,
2007年11月13日 18:21:282007/11/13
收件人 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 个新帖子