Author: autrijus
Date: Wed Feb 22 11:01:51 2006
New Revision: 7784
Modified:
doc/trunk/design/syn/S12.pod
Log:
* S12: replace the inaccurate use eigenclass with metaclass
* Also specify $.foo and $.foo(...) forms as contextful
shorthands of method calls on self.
Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podWed Feb 22 11:01:51 2006
@@ -303,16 +303,16 @@ pass it a prototype object such as Dog
object is, as long as the method body doesn't try to access any information
that
is undefined in the current instance.
-Alternately, you can associate a class method with the current eigenclass
instance,
+Alternately, you can associate a class method with the current metaclass
instance,
which as a singleton object knows your package, and can function as a more
traditional
class method:
our $count;
method ^count { return $count }
-Such an eigenmethod is delegated to C.meta just as method like .does are,
-so it's possible to call this as CDog.count or C$dog.count. However,
-best practice is probably to call such a class method as CDog.^count
+Such an Imetaclass method is always delegated to C.meta just as method like
+C.does are, so it's possible to call this as CDog.count or C$dog.count.
+However, best practice is probably to call such a class method as CDog.^count
or C$dog.^count to make it clear that it's in its own namespace separate
from ordinary methods, and so that your class method cannot be accidentally
overridden by an ordinary method in a subclass--presuming you don't want to
@@ -377,12 +377,25 @@ directly to the attribute values. Outsi
only access to attributes is through the accessors since an object has
to be specified. The dot form of attribute variables may be used in
derived classes because the dot form always implies a virtual accessor
-call. Every dot declaration also declares a corresponding private
-exclamation storage location, and the exclamation form may be used
+call. Every Idot declaration also declares a corresponding private
+Iexclamation storage location, and the exclamation form may be used
only in the actual class, not in derived classes. Reference to the
internal storage location via C$!foo should generally be restricted
to submethods. Ordinary methods should stick to the C$.foo form.
+Because C$.foo, C@.foo, C%.foo, C.foo are just shorthands of
+Cself.foo with different contexts, the class does not need to declare Chas
+$.foo as a property -- a Cmethod foo declaration can work just as well.
+
+The dot form can take an argument list as well. These are all equivalent:
+
+self.foo(1,2,3);# a regular method call
+self.foo.(1,2,3); # ditto
+$.foo(1,2,3); # calls self.foo under $ context
+$.foo.(1,2,3); # ditto
+@.foo(1,2,3); # calls self.foo under @ context
+@.foo.(1,2,3); # ditto
+
Pseudo-assignment to an attribute declaration specifies the default
value. The value on the right is evaluated at class composition
time, that is, while the class is being compiled and the class