cvsuser 04/02/26 10:02:10
Modified: docs/pdds pdd15_objects.pod
Log:
A bit 'o explanation is in order
Revision Changes Path
1.30 +35 -1 parrot/docs/pdds/pdd15_objects.pod
Index: pdd15_objects.pod
===================================================================
RCS file: /cvs/public/parrot/docs/pdds/pdd15_objects.pod,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -w -r1.29 -r1.30
--- pdd15_objects.pod 26 Feb 2004 09:26:23 -0000 1.29
+++ pdd15_objects.pod 26 Feb 2004 18:02:10 -0000 1.30
@@ -525,6 +525,40 @@
classoffset BaseOffset, $P0, "Foo"
BOffset = BaseOffset + 1
getattribute $P1, $P0, BOffset
+
+=head1 Explanations
+
+To get a new class, you can do a C<newclass>, which creates a new
+class with no parents besides parrot's default super-ish parent
+class. (Which doesn't appear in the class list anywhere, though
+arguably it ought to)
+
+To get a new child class, you have two potential options:
+
+=over 4
+
+=item Subclass the parent
+
+=item Create a new standalone class and add a parent
+
+=back
+
+Both ways work. It is, however, more efficient to use the first
+method, and just subclass the immediate parent class of your new
+class.
+
+When adding in extra parents in a multiple-inheritance scenario,
+subclass the first class in the immediate parent list then use the
+C<addparent> op to add in the rest of the immediate parents.
+
+Do be aware that, right now, you should I<not> add attributes or
+parents to a class that's been subclassed or has had objects
+instantiated. This will leave the internal structures of the classses
+and objects in an inconsistent state and things won't work at all the
+way you want them to. At the moment parrot won't warn if you do this,
+but it will soon. The restriction on parent list changes and attribute
+addition will be lifted in future releases, though doing so will be an
+expensive operation.
=head1 TRANSLATION AND GLOSSARY