[svn:perl6-synopsis] r14391 - doc/trunk/design/syn Author: larry Date: Wed May 16 12:36:05 2007 New Revision: 14391 Modified:    doc/trunk/design/syn/S02.pod    doc/trunk/design/syn/S05.pod    doc/trunk/design/syn/S12.pod Log: Now allow "returns" as synonym for "of" (TheDamian++) Reconcile S05's view of Array smartmatch with S03's view Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod	(original) +++ doc/trunk/design/syn/S02.pod	Wed May 16 12:36:05 2007 @@ -12,9 +12,9 @@      Maintainer: Larry Wall     Date: 10 Aug 2004 -  Last Modified: 27 Apr 2007 +  Last Modified: 16 May 2007    Number: 2 -  Version: 102 +  Version: 103    This document summarizes Apocalypse 2, which covers small-scale  lexical items and typological issues.  (These Synopses also contain @@ -813,6 +813,7 @@  container has an implementation type, including subroutines and modules.)  The value type is stored as its C property, while the implementation  type of the container is just the object type of the container itself. +The word C is allowed as an alias for C.    The value type specifies what kinds of values may be stored in the  variable. A value type is given as a prefix or with the C keyword: @@ -833,6 +834,7 @@  is declared, it is assumed to be the same as the C type, if declared.        sub get_pet() of Animal {...}       # of type, obviously +    sub get_pet() returns Animal {...}  # of type      our Animal sub get_pet() {...}      # of type      sub get_pet() as Animal {...}       # as type   @@ -906,10 +908,12 @@  subroutine pays attention to C, and essentially coerces the return  value to the indicated type, just as if you'd coerced each return expression.   -You may also specify the C type as the C trait: +You may also specify the C type as the C trait (with C +allowed as a synonym):        my Hash of Array of Recipe sub get_book ($key) {...}      my sub get_book ($key) of Hash of Array of Recipe {...} +    my sub get_book ($key) returns Hash of Array of Recipe {...}    =head2 Polymorphic types   Modified: doc/trunk/design/syn/S05.pod ============================================================================== --- doc/trunk/design/syn/S05.pod	(original) +++ doc/trunk/design/syn/S05.pod	Wed May 16 12:36:05 2007 @@ -14,9 +14,9 @@     Maintainer: Patrick Michaud  and                 Larry Wall      Date: 24 Jun 2002 -   Last Modified: 27 Apr 2007 +   Last Modified: 16 May 2007     Number: 5 -   Version: 58 +   Version: 59    This document summarizes Apocalypse 5, which is about the new regex  syntax.  We now try to call them I rather than "regular @@ -3426,9 +3426,11 @@  =item *    Any non-compact array of mixed strings or objects can be matched -against a regex: +against a regex as long as you present them as an object with the C +interface, which does not preclude the object having other interfaces +such as C.  Normally you'd use C to generate such an object:   -    @array ~~ / foo <,> bar * /; +    @array.cat ~~ / foo <,> bar * /;    The special C<< <,> >> subrule matches the boundary between elements.  The C<<  >> assertion matches any individual array element. @@ -3437,9 +3439,9 @@  If the array elements are strings, they are concatenated virtually into  a single logical string.  If the array elements are tokens or other  such objects, the objects must provide appropriate methods for the -kinds of subrules to match against.  It is an assertion error to match +kinds of subrules to match against.  It is an assertion failure to match  a string-matching assertion against an object that doesn't provide -a string view.  However, pure object lists can be parsed as long as +a stringified view.  However, pure object lists can be parsed as long as  the match (including any subrules) restricts itself to assertions like:         <.isa(Dog)> @@ -3448,7 +3450,9 @@    It is permissible to mix objects and strings in an array as long as they're  in different elements.  You may not embed objects in strings, however. -Any object may, of course, pretend to be a string element if it likes. +Any object may, of course, pretend to be a string element if it likes, +and so a C object may be used as a substring with the same restrictions +as in the main string.    Please be aware that the warnings on C<.from> and C<.to> returning  opaque objects goes double for matching against an array, where a @@ -3456,13 +3460,21 @@  (potentially) a position within a string of that array.  Do not  expect to do math with such values.  Nor should you expect to be  able to extract a substr that crosses element boundaries. +[Conjecture: Or should you?]    =item *   -To match against each element of an array, use a hyper operator: +To match against every element of an array, use a hyper operator:         @arrayÂ».match($regex);   +=item * + +To match against any element of the array, it suffices to use ordinary +smartmatching: + +    @array ~~ $regex; +  =back    =for vim:set expandtab sw=4: Modified: doc/trunk/design/syn/S12.pod ============================================================================== --- doc/trunk/design/syn/S12.pod	(original) +++ doc/trunk/design/syn/S12.pod	Wed May 16 12:36:05 2007 @@ -12,9 +12,9 @@      Maintainer: Larry Wall     Date: 27 Oct 2004 -  Last Modified: 28 Apr 2007 +  Last Modified: 14 May 2007    Number: 12 -  Version: 49 +  Version: 50    =head1 Overview