Author: larry
Date: Sat Jan 5 17:24:55 2008
New Revision: 14481
Modified:
doc/trunk/design/syn/S02.pod
Log:
Removal of false indication of correspondence between fatarrow and adverbial
special forms,
and much clarification of special adverbial forms, requested by Trey Harris++
Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Jan 5 17:24:55 2008
@@ -12,9 +12,9 @@
Maintainer: Larry Wall [EMAIL PROTECTED]
Date: 10 Aug 2004
- Last Modified: 1 Jan 2008
+ Last Modified: 5 Jan 2008
Number: 2
- Version: 123
+ Version: 124
This document summarizes Apocalypse 2, which covers small-scale
lexical items and typological issues. (These Synopses also contain
@@ -2140,46 +2140,87 @@
a = $$a:$$a
a = @$$a :@$$a (etc.)
a = %fooa%fooa:p
-'' = $x:($x)
-'' = x :x
-'' = ($x,$y) :($x,$y)
-'' = [$x,$y] :[$x,$y]
-'' = {$x = $y}:{$x = $y}
The fatarrow construct may be used only where a term is expected
because it's considered an expression in its own right, since the
-fatarrow is parsed as a normal infix operator (even when autoquoting an
-identifier on its left). The adverbial forms are considered special
-tokens and are recognized in various positions in addition to term
-position. In particular, when used where an infix would be expected
-they modify the previous operator, ignoring the intervening term or
-parenthesized argument. The form is also used to rename parameter
-declarations and to modify the meaning of various quoting forms.
-When appended to an identifier, the adverbial syntax is used to
-generate variants of that identifier; this syntax is used for
-naming operators such as C infix:+ and multiply dispatched
-grammatical rules such as statement_control:if. When so used the
-adverb is considered part of the name, so C infix:+ and C
-infix:- are two different operators. Likewise C prefix:+
- is different from C infix:+ .
-
-Either fatarrow or adverbial pair notation may be used to pass named arguments
as
-terms to a function or method. After a call with parenthesized arguments,
-only adverbial syntax may be used to pass additional arguments. This is
typically
-used to pass an extra block:
+fatarrow itself is parsed as a normal infix operator (even when
+autoquoting an identifier on its left). Because the left side is a
+general expression, the fatarrow form may be used to create a Pair
+with Iany value as the key. On the other hand, when used as above
+to generate CPair objects, the adverbial forms are restricted to
+the use of identifiers as keys. You must use the fatarrow form to
+generate a CPair where the key is not an identifier.
+
+Despite that restriction, it's possible for other things to
+come between a colon and its brackets; however, all of the possible
+non-identifier adverbial keys are reserved for special syntactical
+forms. Perl 6 currently recognizes decimal numbers and the null key.
+In the following table the first and second columns do Inot mean
+the same thing:
+
+Simple pair DIFFERS fromwhich means
+=== ===
+2 = 101010 :2101010 radix literal 0b101010
+8 = 123 :8123 radix literal 0o123
+16 = 123 :16deadbeef radix literal 0xdeadbeef
+16 = 123 :16($somevalue) radix conversion function
+'' = $x:($x) arglist or signature literal
+'' = ($x,$y) :($x,$y)arglist or signature literal
+'' = x :xidentifier extension
+'' = «x» :«x»identifier extension
+'' = [$x,$y] :[$x,$y]identifier extension
+'' = { .say } :{ .say } adverbial block
+
+All of the adverbial forms (including the normal ones with
+identifier keys) are considered special tokens and are recognized
+in various positions in addition to term position. In particular,
+when used where an infix would be expected they modify the previous
+operator, ignoring the intervening term or parenthesized argument:
+
+1 .. 100 :by(3) # count to 100 by threes
+
+Within declarations the form is used to rename parameter declarations:
+
+sub foo ( :externalname($myname) ) {...}
+
+Adverbs modify the meaning of various quoting forms:
+
+q:x 'cat /etc/passwd'
+
+When appended to an identifier (that is, in postfix position),
+the adverbial syntax is used to generate unique variants of that
+identifier; this syntax is used for naming operators such as C
+infix:+ and multiply-dispatched grammatical rules such as
+Cstatement_control:if. When so used, the adverb is considered an
+integral part of the name, so C infix:+ and C infix:-
+are two different operators. Likewise C prefix:+ is different