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

A good news/bad news sort of thing

5 views
Skip to first unread message

Dan Sugalski

unread,
Mar 2, 2004, 10:47:13 AM3/2/04
to perl6-i...@perl.org
The good news is that the infrastructure's in place to do delegated
method calls for vtable functions with objects. So you can actually
do something like:

.sub __MAIN prototyped
.param pmc argv
.local pmc foo
.local pmc bar
.local pmc asub

newclass P1, "Foo"
find_type I0, "Foo"
newsub asub, .Sub, _foo
store_global "Foo", "__get_string", asub

print bar
end
.end

.sub _foo prototyped
print "In foo!\n"
.pcc_begin_return
.pcc_end_return
.end

and expect it to print out "In foo!" like it ought. That is a cool
thing, and we get to do it by subclassing delegate.pmc.

The bad news is that, since all the methods in delegate.pmc are
generated by library code and don't appear in delegate.pmc, you can't
actually subclass from it properly. (I had to hack parrotobject.c to
make it work)

It would be a Good Thing if someone who knows what the heck's going
on in pmc2c2.pl and/or lib/Parrot/Pmc2c.pm could thump this into
working. I'm trying and, well, it's a twisty maze of undocumented
methods, and generally a nasty mess. (I think. It might be terribly
clean, but in that case the documentation is even more sorely lacking)
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

0 new messages