Author: allison
Date: Sun Mar  4 03:40:00 2007
New Revision: 17326

Modified:
   trunk/docs/pdds/draft/pdd15_objects.pod

Log:
[pdd]: Review of updates from 2am design session on object structures.


Modified: trunk/docs/pdds/draft/pdd15_objects.pod
==============================================================================
--- trunk/docs/pdds/draft/pdd15_objects.pod     (original)
+++ trunk/docs/pdds/draft/pdd15_objects.pod     Sun Mar  4 03:40:00 2007
@@ -86,7 +86,8 @@
 implement a core set of dynamic languages (Perl 6, Ruby, Python, etc).
 Other class systems may be implemented later to support other languages.
 
-=item - Classes have an associated namespace. (Which may be anonymous)
+=item - Classes may have an associated namespace. (Anonymous classes are
+not associated with a namespace.)
 
 =item - Classes may have one or more immediate parent classes
 
@@ -191,14 +192,12 @@
 
 =item 5
 
-An array PMC of the methods defined in the class or composed into the
+An hash PMC of the methods defined in the class or composed into the
 class
 
 =item 6
 
-The v-table for the class. The order of dispatch used when building the
-v-table should follow the MRO, and it should be invalidated when the MRO
-changes. Essentially, it is a cache.
+An hash PMC of the overloaded PMC vtable entries for the class.
 
 =item 7
 
@@ -210,33 +209,46 @@
 
 =item 8
 
-The full attribute lookup table. This includes all attributes defined in
-the current class and every other class that it inherits from either
-directly or indirectly. The table is keyed on the name of the class the
-attribute is defined in along with the attribute name. The value is an
-index into the per-object attribute store.
+The full attribute lookup table. This associates attribute names with an
+index into the object's attribute storage (an array). It includes all
+attributes defined in the current class and every other class that it
+inherits from either directly or indirectly. The table is keyed on the
+name of the class where the attribute is defined, along with the
+attribute name. The value is an index into the per-object attribute
+store.
 
 =item 9
 
 The attribute cache. While the attribute lookup table defines every
-attribute, whether it is visible or not with the current MRO, the cache
-maps the names of the visible attributes directly to an index in the per-
-object attribute store. That saves a more costly lookup in the full
-attribute lookup table.
+attribute, whether it is visible or not with the current method
+resolution order (MRO), the cache maps the names of the visible
+attributes directly to an index in the per- object attribute store. That
+saves a more costly lookup in the full attribute lookup table.
 
 =back
 
 The attribute catalog holds only the attributes defined in a particular
-class. When instantiating an object, it is necessary to scan all parent
+class. When instantiating an object, the object data store is created as
+a ResizablePMCArray, so doesn't need any specific details of the class's
+attribute structure. As attributes are set in the object (based on the
+index in the lookup table), the Array expands to accomodate the
+attribute indexes that are actually used. In the common case, a
+relatively small set near the lower index range is all that will be
+used.
+
+When setting the attribute cache it is necessary to scan all parent
 classes as well as the instantiated class for attributes defined there.
-The inheritance rules for a particular HLL will determine which child
-class attributes override which parent class attributes. 
+The inheritance rules (MRO) for a particular HLL will determine which
+child class attributes override which parent class attributes.  The
+cache is only set on individual accesses to a particular attribute.
 
 (If a parent class changes its set of attributes, should that change
 appear in later instantiations of objects from child classes? If so, all
 of these classes would need to be re-constructed as a result of the
-change; note that any already instantiated objects would refer to the old
-class.)
+change; note that any already instantiated objects would refer to the
+old class. NOTE: flag old classes with an "updated" status, to notify
+objects of the old class that they should rebless themselves into the
+new class next time they access the old class?)
 
 Class PMCs also have the "I am a class" flag set on them.
 
@@ -293,7 +305,7 @@
 [Stream-of-consciousness to be cleaned up later]
 The class registry has a much diminished role in this implementation.
 Its only responsibility is maintaining a mapping of unique IDs to class
-objects throught the system. (We may eventually be able to eliminate the
+objects throughout the system. (We may eventually be able to eliminate the
 registry altogether.) It can't be used for looking up classes by name,
 because it's possible to have multiple classes with the same name in the
 same namespace. (When you extend an existing class, it actually creates
@@ -302,7 +314,7 @@
 objects still point to the old class and do their method resolution and
 attribute lookup through that class. If a class hasn't been
 instantiated, adding a method doesn't create a new class. If it has been
-instantiated, the it creates a new class the first time its extended,
+instantiated, it creates a new class the first time its extended,
 and then doesn't create a new class until it is instantiated again.) The
 class registry needs to have names removed entirely (it doesn't care
 about names anymore).  Low-level PMC types also need entries in the
@@ -340,9 +352,13 @@
 
 =back
 
-A list of the object's attributes is accessible from the class.
+A list of the object's attributes is accessible from the class. The
+attribute cache is the most straightforward way to retrieve a complete
+list of attributes visible to the object, but the first time you
+introspect for a complete list the class may have to calculate the list
+by traversing the inheritance hierarchy.
 
-Note that Object PMCs have the "I am an object" flag set on them.
+Object PMCs have the "I am an object" flag set on them.
 
 Object PMCs have no methods aside from those defined in their associated
 class. They do have vtable methods providing access to certain low-level

Reply via email to