r27103 - docs/Perl6/Spec

2009-06-17 Thread pugs-commits
Author: lwall
Date: 2009-06-17 17:26:04 +0200 (Wed, 17 Jun 2009)
New Revision: 27103

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29-functions] fix some misplaced types


Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-06-17 13:53:48 UTC (rev 27102)
+++ docs/Perl6/Spec/S29-functions.pod   2009-06-17 15:26:04 UTC (rev 27103)
@@ -282,9 +282,9 @@
 
 =item ord
 
- multi Char method chr( Int $grid: ) is export
- multi Char sub chr( Int *...@grid )
- multi Int method ord( Str $string: ) is export
+ multi method chr( Int $grid: -- Char ) is export
+ multi sub chr( Int *...@grid  -- Char )
+ multi method ord( Str $string: -- Int ) is export
 
 Cchr takes zero or more integer grapheme ids and returns the
 corresponding characters as a string.  If any grapheme id is used



r27106 - docs/Perl6/Spec

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

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[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.pod2009-06-17 18:49:52 UTC (rev 27105)
+++ docs/Perl6/Spec/S02-bits.pod2009-06-17 19:08:15 UTC (rev 27106)
@@ -12,8 +12,8 @@
 
   Maintainer: Larry Wall la...@wall.org
   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 CArray of Int is equivalent to
 another CArray 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 CArray of Int syntax
+is just sugar for CArray: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 Cutf8 type is derived from Cbuf8, with the additional constraint
+that it may only contain validly encoded UTF-8.  Likewise, Cutf16 is
+derived from Cbuf16, and Cutf32 from Cbuf32.
+
+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:



r27112 - docs/Perl6/Spec

2009-06-17 Thread pugs-commits
Author: lwall
Date: 2009-06-18 01:36:07 +0200 (Thu, 18 Jun 2009)
New Revision: 27112

Modified:
   docs/Perl6/Spec/S09-data.pod
Log:
[S09] add missing rat native types


Modified: docs/Perl6/Spec/S09-data.pod
===
--- docs/Perl6/Spec/S09-data.pod2009-06-17 23:30:20 UTC (rev 27111)
+++ docs/Perl6/Spec/S09-data.pod2009-06-17 23:36:07 UTC (rev 27112)
@@ -12,8 +12,8 @@
 
   Maintainer: Larry Wall la...@wall.org
   Date: 13 Sep 2004
-  Last Modified: 30 Apr 2009
-  Version: 33
+  Last Modified: 17 Jun 2009
+  Version: 34
 
 =head1 Overview
 
@@ -59,6 +59,11 @@
 complex64   (aka complex on most architectures)
 complex128
 
+rat8
+rat16
+rat32
+rat64
+
 buf8aka buf, a normal byte buffer
 buf16   a uint16 buffer
 buf32   a uint32 buffer



Re: Why pass by reference?

2009-06-17 Thread John M. Dlugosz

TSa Thomas.Sandlass-at-vts-systems.de |Perl 6| wrote:

HaloO,

Matthew Walton wrote:

If a user of your API contrives to make it change while you're
running, that's their own foot they've just shot, because they can
look at the signature and know the semantics of the parameter passing
being used and know that if they change the value externally before
you return Bad Things Could Happen.


I agree that the caller is responsible for the constness of the value
he gives to a function. With this we get the best performance. I don't
understand why John thinks that an intermediate proxy is needed. A very
shallow wrapper that ensures the readonlyness suffices. Most of the
time not even that when the constness is known statically.


Regards TSa.
shallow wrapper is what I'm talking about.  That is indeed a proxy: if 
a full-blown run-time check is needed (when it gets passed beyond its 
ability to track at compile time) it forwards methods, intercepts 
others, and modifies accessors.