Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

[svn:parrot-pdd] r17322 - trunk/docs/pdds/draft

已查看 6 次
跳至第一个未读帖子

jona...@cvs.perl.org

未读,
2007年3月4日 05:19:162007/3/4
收件人 perl6-i...@perl.org
Author: jonathan
Date: Sun Mar 4 02:19:10 2007
New Revision: 17322

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

Log:
Describe new class and object layout for objects. We now push a lot into the class and make objects really lightweight, since you will usually instantiate many objects per class.

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 02:19:10 2007
@@ -18,7 +18,7 @@

=head2 Object

-An object is kind a variable that incorporates both data and behavior
+An object is a variable that incorporates both data and behavior
related to that data.

=head2 Class
@@ -194,12 +194,35 @@
An array PMC of the methods defined in the class or composed into the
class

-
=item 6

-The class attribute hash. Keys are the attribute names and the values
-are a hash of attribute characteristics, including name, type, and the
-class they're associated with.
+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.
+
+=item 7
+
+The class attribute metadata hash. Keys are the attribute names and the
+values are a hash of attribute characteristics, including name, type, the
+class they're associated with and any flags (for example, private). Note
+that this only stores metadata for the attributes defined in this class,
+and not for attributes inherited from its parents.
+
+=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.
+
+=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.

=back

@@ -209,13 +232,11 @@
The inheritance rules for a particular HLL will determine which child
class attributes override which parent class attributes.

-We may also add a cache to the class object: a hash that contains all
-child and parent attribute characteristcs. Whether this is useful
-largely depends on how slow it is to scan through the list of parent
-classes, and how dynamic we want the system to be. (If a parent class
-changes its set of attributes, should that change appear in later
-instantiations of objects from child classes? Probably, in which case
-caching parent attributes is an obstacle.)
+(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.)

Class PMCs also have the "I am a class" flag set on them.

@@ -311,20 +332,15 @@

=item 1

-The class name
-
-=item 2
-
-The object attribute hash. Keys are the attribute names and the values
-are the attribute values. (The "hash" may be implemented as a typed
-structure following the CStruct proposal.)
+The object attribute store. This is simply an array of PMCs that
+provide the values for the attributes. It may be a resizable PMC array
+to provide lazy growth rather than allocating all needed memory for
+all attributes. We find the indexes into this array from the attribute
+cache or lookup table in the class.

=back

-A list of the object's attributes is accessible by extracting the keys
-from the object attribute hash. This direct introspetive capability may
-not be directly exposed in the HLLs (preserving the boundaries of an
-opaque object).
+A list of the object's attributes is accessible from the class.

Note that Object PMCs have the "I am an object" flag set on them.

Bob Rogers

未读,
2007年3月4日 10:57:452007/3/4
收件人 jona...@cvs.perl.org、perl6-i...@perl.org
From: jona...@cvs.perl.org
Date: Sun, 4 Mar 2007 02:19:16 -0800 (PST)

Author: jonathan
Date: Sun Mar 4 02:19:10 2007
New Revision: 17322

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

. . .

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 02:19:10 2007
@@ -18,7 +18,7 @@

=head2 Object

-An object is kind a variable that incorporates both data and behavior
+An object is a variable that incorporates both data and behavior
related to that data.

=head2 Class
. . .

?? Not "An object is a value . . ."?

-- Bob Rogers
http://rgrjr.dyndns.org/

0 个新帖子