Front page | perl.perl6.language |
Postings from April 2006
[svn:perl6-synopsis] r8967 - doc/trunk/design/syn
From:
larry
Date:
April 26, 2006 14:41
Subject:
[svn:perl6-synopsis] r8967 - doc/trunk/design/syn
Message ID:
20060426214123.674E7CBA6D@x12.develooper.com
Author: larry
Date: Wed Apr 26 14:41:21 2006
New Revision: 8967
Modified:
doc/trunk/design/syn/S02.pod
doc/trunk/design/syn/S03.pod
Log:
Typos, clarifications.
Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod (original)
+++ doc/trunk/design/syn/S02.pod Wed Apr 26 14:41:21 2006
@@ -56,7 +56,7 @@
Ps/Pe properties, though ASCII angle brackets are a notable exception,
since they're bidirectional but not in the Ps/Pe set.
-Characters with no corresponding closing characters does not qualify
+Characters with no corresponding closing character do not qualify
as opening brackets. This includes the second section of the BidiMirroring
data table, as well as C<U+201A> and C<U+201E>.
Modified: doc/trunk/design/syn/S03.pod
==============================================================================
--- doc/trunk/design/syn/S03.pod (original)
+++ doc/trunk/design/syn/S03.pod Wed Apr 26 14:41:21 2006
@@ -12,9 +12,9 @@
Maintainer: Larry Wall <larry@wall.org>
Date: 8 Mar 2004
- Last Modified: 25 Apr 2006
+ Last Modified: 26 Apr 2006
Number: 3
- Version: 23
+ Version: 24
=head1 Changes to existing operators
@@ -99,9 +99,21 @@
loop ($a = 1, $b = 2; ; $a++, $b++) {...}
still works fine. The distinction between scalar and list assignment
-is pretty much identical to the way Perl 5 does it. If there are
-parens around the left side, or if the sigil of the variable is C<@>
-or C<%>, it's a list assignment. Otherwise it's a scalar assignment.
+is similar to the way Perl 5 does it. If there are parens around
+the left side, or if the variable is an array or hash, it's a list
+assignment. Otherwise it's a scalar assignment. One difference from
+Perl 5 is that Perl 6 does not attempt to intuit whether an lvalue
+slice is meant to be one element or several, so you must use parens
+in that case. This is true even if you put something that is obviously
+a list as the subscript:
+
+ @x[1,2,3] = 4,5,6; # WRONG
+ (@x[1,2,3]) = 4,5,6; # correct
+
+These parens actually apply list context on both sides:
+
+ @x[foo()] = bar(); # foo() and bar() both in scalar context
+ (@x[foo()]) = bar(); # foo() and bar() both in list context
=back
@@ -719,6 +731,25 @@
$hacker.feed: 'Pizza and cola';
+This colon is a separate token. A colon prefixing an adverb is not
+a separate token. Therefore, under the longest-token rule,
+
+ $hacker.feed:xxx('Pizza and cola');
+
+is tokenized as an adverb applying to the method:
+
+ $hacker.feed :xxx('Pizza and cola');
+
+not as an xxx sub in the argument list of .feed:
+
+ $hacker.feed: xxx('Pizza and cola'); # wrong
+
+If you want both meanings of colon, you have to put it twice:
+
+ $hacker.feed: :xxx('Pizza and cola'), 1,2,3;
+
+(For similar reasons it's best to put whitespace after the colon of a label.)
+
=head1 C<zip>
In order to support parallel iteration over multiple arrays, Perl 6 has
@@ -782,12 +813,12 @@
method postfix . .+ .? .* .() .[] .{} .«» .=
autoincrement ++ --
exponentiation **
- symbolic unary ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ = -e -r -w -x etc.
+ symbolic unary ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ =
multiplicative * / % x xx +& +< +> ~& ~< ~>
additive + - ~ +| +^ ~| ~^
junctive and (all) &
junctive or (any) | ^
- named unary rand sleep abs etc.
+ named unary rand sleep abs etc. -e -r -w -x etc.
nonchaining binary but does cmp <=> .. ^.. ..^ ^..^ ff ^ff ff^ ^ff^ fff ^fff etc.
chaining binary != == < <= > >= ~~ !~ eq ne lt le gt ge =:= ===
tight and &&
-
[svn:perl6-synopsis] r8967 - doc/trunk/design/syn
by larry