Author: lwall
Date: 2009-06-17 21:08:15 +0200 (Wed, 17 Jun 2009)
New Revision: 27106

[S02] define utf constrained buffer types
[S02] nail down canonical name for instantiated types to use ident adverbial
  (MyRole[MyType] still instantiates, but isn't the name of the resulting type)

Modified: docs/Perl6/Spec/S02-bits.pod
--- docs/Perl6/Spec/S02-bits.pod        2009-06-17 18:49:52 UTC (rev 27105)
+++ docs/Perl6/Spec/S02-bits.pod        2009-06-17 19:08:15 UTC (rev 27106)
@@ -12,8 +12,8 @@
   Maintainer: Larry Wall <>
   Date: 10 Aug 2004
-  Last Modified: 2 Jun 2009
-  Version: 170
+  Last Modified: 17 Jun 2009
+  Version: 171
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -464,7 +464,9 @@
 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.
+equivalent to the original type.  In particular, the C<Array of Int> syntax
+is just sugar for C<Array:of(Int)>, which is the canonical form of an
+instantiated generic type.
 This name equivalence of parametric types extends only to parameters
 that can be considered immutable (or that at least can have an
@@ -800,6 +802,26 @@
 =item *
+The C<utf8> type is derived from C<buf8>, with the additional constraint
+that it may only contain validly encoded UTF-8.  Likewise, C<utf16> is
+derived from C<buf16>, and C<utf32> from C<buf32>.
+Note that since these are type names, parentheses must always be
+used to call them as coercers, since the listop form is not allowed
+for coercions.  That is:
+    utf8 op $x
+is always parsed as
+    (utf8) op $x
+and never as
+    utf8(op $x)
+=item *
 The C<*> character as a standalone term captures the notion of
 "Whatever", which is applied lazily by whatever operator it is an
 argument to.  Generally it can just be thought of as a "glob" that
@@ -1163,7 +1185,7 @@
 actually means:
-    my Hash[Array[Recipe]] %book; 
+    my Hash:of(Array:of(Recipe)) %book; 
 Because the actual variable can be hard to find when complex types are
 specified, there is a postfix form as well:
@@ -1215,6 +1237,10 @@
     my Cat|Dog Fish $mitsy = new Fish but { Bool.pick ?? .does Cat
                                                       !! .does Dog };
+[Note: the above is a slight lie, insofar as parameters are currently
+restricted for 6.0.0 to having only a single main type for the
+formal variable until we understand MMD a bit better.]
 =head2 Parameter types
 Parameters may be given types, just like any other variable:

Reply via email to