Jeff Clites wrote:
On Nov 27, 2004, at 5:58 PM, liorean wrote:

On Sat, 27 Nov 2004 19:30:20 -0500, Sam Ruby <[EMAIL PROTECTED]> wrote:

Overall, JavaScript would be a good match for Parrot. One place where it would significantly diverge at the moment is in the concept of a "class". Objects in JavaScript are little more than bundles of properites, some of which may be functions. And classes are essentially templates for such objects.

I don't really think it's that strange. Essentially, all objects contain a reference to their prototype. When getting a member of an object, the object will first check it's own members for the corresponding identifier, then ask it's prototype, and so on until the prototype chain is depleted. Setting is always done on the object itself. It's really not so much inheritance as it is conditional runtime delegation. Functions are of course first class and shouldn't differ from any other member - there is no native method/property distinction in JavaScript, even though host object may have such a distinction.

This seems to me to be very much the way Python works as well, though the emphasis is different. (That is, the common case in Python is to define methods per-class rather than per-instance, and in JavaScript it's the opposite. But that's not a technological difference, just a cultural one.) I would think that the implementations would share a lot.

I agree with both of you (and with Luke's observation on the existance of a find_method vtable entry, which I've used to good advantage already inside PyClass.pmc).


What I am finding is that a very different approach is embedded inside object.c and needs to be factored out into what is currently (mis-)named ParrotObject and ParrotClass.

I have ideas on how this should be handled, but my needs are not (yet) urgent, and Dan has expressed an interest in making the change, so I'm willing to wait for a little bit.

- Sam Ruby

Reply via email to