Author: larry
Date: Wed Aug  9 18:34:02 2006
New Revision: 10758

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S12.pod

Log:
Renamed pseudo-methods and functions in uppercase to be more like typecasts.
In particular,
    .meta       -> META() or .META
    .valid      -> SKID() or .SKID
    variable()  -> VAR()  or .VAR
Note that .VAR is not a true method, but a postfix:<VAR> macro!


Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Wed Aug  9 18:34:02 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 7 Aug 2006
+  Last Modified: 9 Aug 2006
   Number: 2
-  Version: 60
+  Version: 61
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -438,6 +438,13 @@
 repeated autoboxing can slow your program more than the native type
 can speed it up.)
 
+Some object types can behave as value types.  Every object can produce
+a "safe key identifier" (C<SKID> for short) that uniquely identifies the
+object for hashing and other value-base comparisons.  Normal objects
+just use their address in memory, but if a class wishes to behave as a
+value type, it can define a C<.SKID> method that makes different objects
+look like the same object if they happen to have the same contents.
+
 =item *
 
 Variables with non-native types can always contain I<undefined> values,
@@ -453,15 +460,19 @@
 
 =item *
 
-All objects support a C<.meta> method that returns the class instance
-managing it, regardless of whether the object is defined:
-
-    'x'.meta.get_method_list;   # get available methods for strings
-    Str.meta.get_method_list;   # same thing with the prototype object Str
+Every object supports a C<META> function/method that returns the
+metaclass instance managing it, regardless of whether the object
+is defined:
+
+    'x'.META.get_method_list;   # get available methods for strings
+    Str.META.get_method_list;   # same thing with the prototype object Str
+    META(Str).get_method_list;  # same thing as function call
 
     'x'.get_method_list;        # this is an error - not a meta object
     Str.get_method_list;        # same thing
 
+(For a prototype system (a non-class-based object system), all objects are 
merely managed by the same meta object.)
+
 =item *
 
 Perl 6 intrinsically supports big integers and rationals through its

Modified: doc/trunk/design/syn/S03.pod
==============================================================================
--- doc/trunk/design/syn/S03.pod        (original)
+++ doc/trunk/design/syn/S03.pod        Wed Aug  9 18:34:02 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 7 Aug 2006
+  Last Modified: 9 Aug 2006
   Number: 3
-  Version: 53
+  Version: 54
 
 =head1 Changes to Perl 5 operators
 
@@ -373,16 +373,13 @@
 C<Array> objects, but it is true that C<@a === @a> because those are
 the same C<Array> object).
 
-Any object type may pretend to be a value type by defining a C<.valid>
+Any object type may pretend to be a value type by defining a C<.SKID>
 method which returns a value type that can be recursively compared
 using C<===>, or in cases where that is impractical, by overloading
 C<===> such that the comparison treats values consistently with their
 "eternal" identity.  (Strings are defined as values this way despite
 also being objects.)
 
-(Because Perl 6 uses a false C<.valid> to signify a non-instantiated prototype,
-all instances should arrange to return a C<.valid> that boolifies to true.)
-
 Two values are never equivalent unless they are of exactly the same type.  By
 contrast, C<eq> always coerces to string, while C<==> always coerces to
 numeric.  In fact, C<$a eq $b> really means "C<~$a === ~$b>" and C<$a == $b>
@@ -497,8 +494,8 @@
     for ^(3,3) { ... } # (0,0)(0,1)(0,2)(1,0)(1,1)(1,2)(2,0)(2,1)(2,2)
 
 If applied to a type name, it indicates the metaclass instance instead,
-so C<^Moose> is short for C<Moose.meta>.  It still kinda means "what
-is this thing's domain" in an abstract sort of way.
+so C<^Moose> is short for C<META(Moose)> or C<Moose.META>.  It still kinda
+means "what is this thing's domain" in an abstract sort of way.
 
 =item * The C<...> operator is the "yada, yada, yada" list operator,
 which is used as the body in function prototypes.  It complains
@@ -515,7 +512,7 @@
 variants C<.*>, C<.?>, and C<.+> to control how multiple related methods
 of the same name are handled.  The C<.=> operator does inplace modification
 of the object on the left.  The C<.^> operator calls a class metamethod;
-C<foo.^bar> is short for C<foo.meta.bar>.
+C<foo.^bar> is short for C<foo.META.bar>.
 
 =item * Unary C<=> reads lines from a filehandle or filename, or
 iterates an iterator, or in general causes a scalar to explode its guts

Modified: doc/trunk/design/syn/S04.pod
==============================================================================
--- doc/trunk/design/syn/S04.pod        (original)
+++ doc/trunk/design/syn/S04.pod        Wed Aug  9 18:34:02 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 26 July 2006
+  Last Modified: 9 Aug 2006
   Number: 4
-  Version: 31
+  Version: 32
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -584,7 +584,7 @@
 C<Failure> objects, any of which refers to an unthrown C<Exception> object in
 C<$!> and knows whether it has been handled or not.
 
-If you test a C<Failure> for C<.valid>, C<.defined> or C<.true>, it causes
+If you test a C<Failure> for C<.defined> or C<.true>, it causes
 C<$!> to mark the exception as I<handled>, and acts as a harmless C<Undef>
 value thereafter.  Any other use of the C<Failure> will throw its associated
 exception immediately.

Modified: doc/trunk/design/syn/S06.pod
==============================================================================
--- doc/trunk/design/syn/S06.pod        (original)
+++ doc/trunk/design/syn/S06.pod        Wed Aug  9 18:34:02 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 7 Aug 2006
+  Last Modified: 9 Aug 2006
   Number: 6
-  Version: 43
+  Version: 44
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1339,8 +1339,8 @@
 
 =head2 Undefined types
 
-These can behave as values or objects of any class, but always return
-a C<.valid> that evaluates to false.  One can create them with the
+These can behave as values or objects of any class, except that
+C<defined> always returns false.  One can create them with the
 built-in C<undef> and C<fail> functions.  (See S02 for how failures
 are handled.)
 
@@ -1351,7 +1351,8 @@
 =head2 Immutable types
 
 Objects with these types behave like values, i.e. C<$x === $y> is true
-if and only if their types and contents are identical.
+if and only if their types and contents are identical (that is, if
+C<$x.SKID> eqv C<$y.SKID>).
 
     Bit         Perl single bit (allows traits, aliasing, undef, etc.)
     Int         Perl integer (allows Inf/NaN, arbitrary precision, etc.)
@@ -1371,10 +1372,12 @@
     Mapping     Pairs with no duplicate keys
     Signature   Function parameters (left-hand side of a binding)
     Capture     Function call arguments (right-hand side of a binding)
+    Blob       An undifferentiated mass of bits
 
 =head2 Mutable types
 
-Objects with these types have distinct C<.valid> values.
+Objects with these types have distinct C<.SKID> values that do not change
+even if the object's contents change.
 
     Array       Perl array
     Hash        Perl hash
@@ -1957,10 +1960,10 @@
 
     class LoudArray is Array {
         method TEMP {
-            print "Replacing $.valid() at {caller.location}\n";
+            print "Replacing $.SKID() at {caller.location}\n";
             my $restorer = $.SUPER::TEMP();
             return { 
-                print "Restoring $.valid() at {caller.location}\n";
+                print "Restoring $.SKID() at {caller.location}\n";
                 $restorer();
             };
         }
@@ -2016,7 +2019,7 @@
     &old_thermo := &thermo;
     &thermo := sub ($t) { old_thermo( ($t-32)/1.8 ) }
 
-Except that C<&thermo> is mutated in-place, so C<&thermo.valid> stays the same
+Except that C<&thermo> is mutated in-place, so C<&thermo.SKID> stays the same
 after the C<.wrap>.
 
 The call to C<.wrap> returns a unique handle that can later be passed to

Modified: doc/trunk/design/syn/S12.pod
==============================================================================
--- doc/trunk/design/syn/S12.pod        (original)
+++ doc/trunk/design/syn/S12.pod        Wed Aug  9 18:34:02 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 29 Jun 2006
+  Last Modified: 9 Aug 2006
   Number: 12
-  Version: 18
+  Version: 19
 
 =head1 Overview
 
@@ -34,7 +34,7 @@
 that type can do.  The class object is an Object, but it is not a
 Class, because there is no mandatory Class class in Perl 6.  We wish
 to support both class-based and prototype-based OO programming.
-So all metaprogramming is done through the current object's C<.meta>
+So all metaprogramming is done through the current object's C<META>
 object, which can delegate metaprogramming to any metamodel it likes.
 However, by default, objects derived from Object support a fairly
 standard class-based model.
@@ -120,19 +120,19 @@
 
 Every object (including any class object) delegates to an instance of
 its metaclass.  You can get at the metaclass of any object via the
-C<.meta> method.  A "class" object is just considered an "empty"
+C<META> method.  A "class" object is just considered an "empty"
 instance in Perl 6, more properly called a "prototype" object.
 The actual class object is the metaclass object pointed to by the
-C<.meta> syntax.  So when you say "Dog", you're referring to both a
+C<META> syntax.  So when you say "Dog", you're referring to both a
 package and a prototype object, that latter of which points to the
-actual object representing the class via C<.meta>.  The prototype
+actual object representing the class via C<META>.  The prototype
 object differs from an instance object not by having a different
 type but rather in the extent to which it is defined.  Some objects
 may tell you that they are defined, while others may tell you that
 they are undefined.  That's up to the object, and depends on how the
 metaclass chooses to dispatch the .defined method.
 
-The notation C<^Dog> is syntactic sugar for C<Dog.meta>, so C<^> can be
+The notation C<^Dog> is syntactic sugar for C<Dog.META>, so C<^> can be
 considered the "class" sigil when you want to talk about the current
 metaclass instance.
 
@@ -300,14 +300,21 @@
     @keys  = %hash.keys;
     $sig   = &sub.signature;
 
-Use the C<variable> pseudo-function on a scalar variable to get at its
+Use the C<VAR> pseudo-function on a scalar variable to get at its
 underlying C<Scalar> object:
 
-    if variable($scalar).constant {...}
+    if VAR($scalar).readonly {...}
+
+There's also a corresponding postfix:<VAR> macro that can be used
+as if it were a method:
+
+    if $scalar.VAR.readonly {...}
+
+(But since it's a macro, C<VAR> is not dispatched as a real method.)
 
 You can also get at the container through the appropriate symbol table:
 
-    if MY::<$scalar>.constant {...}
+    if MY::<$scalar>.readonly {...}
 
 =head1 Class methods
 
@@ -325,7 +332,7 @@
     our $count;
     method ^count { return $count }
 
-Such a I<metaclass method> is always delegated to C<.meta> just as methods like
+Such a I<metaclass method> is always delegated to the C<META> object just as 
methods like
 C<.does> are, so it's possible to call this as C<Dog.count> or C<$dog.count>.
 However, best practice is probably to call such a class method as C<Dog.^count>
 or C<$dog.^count> to make it clear that it's in its own namespace separate
@@ -1488,22 +1495,23 @@
 
 =head1 Introspection
 
-Every class object has a C<.meta> method that lets you get at the
-class's metaclass object, which lets you get at all the metadata
-properties for the class:
+Every class has a C<META> function/method that lets you get at the
+class's metaobject, which lets you get at all the metadata properties
+for the class (or other metaobject protocol) implementing the objects
+of the class:
 
     MyClass.getmethods()       # call MyClass's .getmethods method (error?)
-    MyClass.meta.getmethods()  # get the method list of MyClass
+    MyClass.META.getmethods()  # get the method list of MyClass
 
-The C<^> metasyntax is equivalent to .meta:
+The C<^> metasyntax is equivalent to .META:
 
-    MyClass.meta.getmethods()  # get the method list of MyClass
+    MyClass.META.getmethods()  # get the method list of MyClass
     ^MyClass.getmethods()      # get the method list of MyClass
     MyClass.^getmethods()      # get the method list of MyClass
 
-Each object of the class also has a C<.meta> or C<.^> method:
+Each object of the class also has a C<.META> or C<.^> method:
 
-    $obj.meta.getmethods();
+    $obj.META.getmethods();
     $obj.^getmethods();
 
 Class traits may include:
@@ -1522,7 +1530,7 @@
     disambig      how to deal with ambiguous method names from roles
     layout        P6opaque, P6hash, P5hash, P5array, PyDict, Cstruct, etc.
 
-The C<.meta.getmethods> method returns method-descriptors containing:
+The C<.META.getmethods> method returns method-descriptors containing:
 
     name               the name of the method
     signature          the parameters of the method
@@ -1544,14 +1552,14 @@
     private
     accessor
     build
-    constant
+    readonly
 
 Strictly speaking, metamethods like C<.isa()>, C<.does()>, and C<.can()>
 should be called through the meta object:
 
-    $obj.meta.can("bark")
-    $obj.meta.does(Dog)
-    $obj.meta.isa(Mammal)
+    $obj.META.can("bark")
+    $obj.META.does(Dog)
+    $obj.META.isa(Mammal)
 
 But C<Object> gives you shortcuts to those, if you don't override them.
 
@@ -1561,13 +1569,13 @@
 
 actually calls:
 
-    $obj.meta.does(Dog)
+    $obj.META.does(Dog)
 
 which is true if C<$obj> either "does" or "isa" C<Dog> (or "isa"
 something that "does" C<Dog>).
 
 Unlike in Perl 5 where C<.can> returns a single C<Code> object,
-Perl 6's version of C<.meta.can> returns a "WALK" iterator for a
+Perl 6's version of C<.META.can> returns a "WALK" iterator for a
 set of routines that match the name, including all autoloaded and
 wildcarded possibilities.  In particular, C<.can> interrogates
 any class package's C<CANDO> method for names that are to be considered 
autoloadable methods

Reply via email to