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

[perl #39056] [BUG] vtable override doesn't work in sub-subclasses

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

Patrick R . Michaud

未读,
2006年5月2日 18:30:292006/5/2
收件人 bugs-bi...@rt.perl.org
# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #39056]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39056 >


Vtable overrides don't appear to work in a once-removed subclass
(i.e., a subclass of a subclass). It's easiest to explain with
code:

$ cat z.pir
.sub main :main
.local pmc base
$P0 = getclass 'Integer'
base = subclass $P0, 'Foo' # create subclass 'Foo'
addattribute base, '@!capt'

$P0 = subclass 'Foo', 'Bar' # create subclass 'Bar'
$P1 = new 'Bar' # create an instance of 'Bar'

$S1 = $P1 # get its string representation
print $S1 # display it
print "\n"
.end


.namespace [ 'Bar' ]

.sub '__get_string' :method
$S0 = 'ok bar'
.return ($S0)
.end

$ ./parrot z.pir
0
$

I expect that I should get 'ok bar' as output here instead of '0'.
However, if the intermediate class 'Foo' above defines a
'__get_string' method, then everything works as expected.

I'll add this to the Parrot test suite as soon as I get the
RT ticket number.

Pm

Leopold Toetsch

未读,
2006年5月25日 06:21:132006/5/25
收件人 perl6-i...@perl.org、Patrick R.Michaud (via RT)、bugs-bi...@netlabs.develooper.com
Am Mittwoch, 3. Mai 2006 00:30 schrieb Patrick R.Michaud (via RT):
> Vtable overrides don't appear to work in a once-removed subclass
> (i.e., a subclass of a subclass).  It's easiest to explain with
> code:

Fixed now in r12797.

Thanks for the test.
leo

0 个新帖子