At 12:38 PM -0800 1/14/03, Jonathan Sillito wrote:
 > -----Original Message-----
 From: Dan Sugalski [mailto:[EMAIL PROTECTED]]

 A property is a runtime assignable name/value pair that you stick on
 a variable or value. An attribute is a named variable that all
 objects of a particular class have.

 Properties can come and go at runtime, but attributes are fixed. (I
 think you could also consider attributes "instance variables", but
 I'm a bit OO fuzzy so I'm not sure that's entirely right)
Ok, in the case of python or ruby, instance variables are not fixed and they
are not declared as part of the class. I suppose this can be handled by
giving such classes one hash attribute for storing these instance variables.
Less work than that even. While the attributes aren't declared formally, the compiler definitely knows what they are, and can allocate space as needed. The only place you'll run into issues is either runtime introduction of attributes (after the class has been compiled) or writing to attributes by name.

Though the need to add attributes after the fact is an important one--we don't want to have to go rejigging every object that derives from some wacky parent class every time that class adds or removes an attribute.

 > You're off. It'll be something like:
     callmethod Px, "method_name"

 or

     jmpmethod Px, "method_name"

Is there going to be any way to (in PASM) find a method with out invoking
it? I am not sure, but it may be useful for currying and some efficiency
stuff (like moving dispatch outside of a loop that repeatedly invokes a
method).
Yep. There should be a can operator, though I'm not sure how often one wants to check for the existence of a method in an object without calling it. But no reason not to. More for rev 2.

 > >Do we store ptrs to parent classes in one of these slots? Also
 Can I access
 >slots like:
 >
 >   set Px, Py[1]    # store the name to offset hash in Px

 No the parent's gotten to via the vtable, and yes you can.
Sorry if this is obvious, but which vtable method is used to get the
parents?
It should be hanging off the vtable as one of the fixed slots. I think it isn't, though, so that needs fixing too.
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk

Reply via email to