Author: larry
Date: Mon Sep 18 20:33:07 2006
New Revision: 12185

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Some handwaving about type equivalence.


Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Mon Sep 18 20:33:07 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 13 Sept 2006
+  Last Modified: 18 Sept 2006
   Number: 2
-  Version: 68
+  Version: 69
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -346,6 +346,25 @@
 
 =item *
 
+Types are officially compared using name equivalence rather than
+structural equivalence.  However, we're rather liberal in what we
+consider a name.  For example, the name includes the version and
+authority associated with the module defining the type (even if
+the type itself is "anonymous").  Beyond that, when you instantiate
+a parametric type, the arguments are considered part of the "long
+name" of the resulting type, so one C<Array of Int> is equivalent to
+another C<Array of Int>.  (Another way to look at it is that the type
+instantiation "factory" is memoized.)  Typename aliases are considered
+equivalent to the original type.
+
+This name equivalence of parametric types extends only to parameters
+that can be considered immutable (or that at least can have an
+immutable snapshot taken of them).  Two distinct classes are never
+considered equivalent even if they have the same attributes because
+classes are not considered immutable.
+
+=item *
+
 Perl 6 supports the notion of B<properties> on various kinds of
 objects.  Properties are like object attributes, except that they're
 managed by the individual object rather than by the object's class.

Reply via email to