Message from discussion Objects!
Mailing-List: contact perl6-internals-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-intern...@perl.org
X-Scanned-By: AMaViS-ng at sidhe.org
Date: Tue, 2 Dec 2003 10:52:18 -0500
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Spam-Status: No, hits=0.8 required=7.0 tests=CARRIAGE_RETURNS,SPAM_PHRASE_01_02 version=2.44
X-SMTPD: qpsmtpd/0.26, http://develooper.com/code/qpsmtpd/
From: d...@sidhe.org (Dan Sugalski)
Well, objects-ish, at least.
Single-inheritance objects seem to be done. The code can use a lot of
abuse and cleanup, and we need actual tests to make sure that it
functions as it should, but they're in.
Here's the technical scoop.
When you create a ParrotClass-based class (which is to say, you use
the class creation ops that we provide) you get a class PMC that's
got all the class information hanging off it. This stuff's documented
at the top of classes/parrotclass.pmc though better docs are
definitely in order.
Since creating the class is handled by the code in objects.c rather
than in the class vtable, we get to play a number of games:
Games we play:
*) The class code knows its dealing with parrot classes (there's a
flag to tell us) and it cheats. Not too badly, but some. Probably
should cheat more, but I'm up for getting it working before doing
Horribly Evil Things.
*) Creating new objects involves calling the ->init vtable entry *on
the class*. Because of this each class gets a custom vtable where the
init method has been swapped out for one (from objects.c) that
creates a new object instead.
But it seems to work out. Slowly (no method cache definitely hurts)
but still, works is good. The PMC that the class ->init method hands
back is a ParrotObject, rather than a ParrotClass, which is good as
it's an object and all. The vtable on the object is currently the
base ParrotObject vtable which, as you can probably see, doesn't do a
whole lot besides method calls.
Still to do:
*) Multiple inheritance
*) Runtime inheritance changes
*) Runtime attribute changes
*) Metadata support for class creation
*) Tests to make sure it actually, y'know, works.
*) Delegation of vtable methods to methods in the class
*) fallback method finding
Happy "Abuse the Objects" day, everyone. :)
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk