develooper Front page | perl.perl6.language | Postings from June 2006

[svn:perl6-synopsis] r9538 - doc/trunk/design/syn

From:
audreyt
Date:
June 10, 2006 21:56
Subject:
[svn:perl6-synopsis] r9538 - doc/trunk/design/syn
Message ID:
20060611045509.23100CBF2B@x12.develooper.com
Author: audreyt
Date: Sat Jun 10 21:55:09 2006
New Revision: 9538

Modified:
   doc/trunk/design/syn/S02.pod

Log:
* S02: Subscripts are now always in list context, period.

Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod	(original)
+++ doc/trunk/design/syn/S02.pod	Sat Jun 10 21:55:09 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <larry@wall.org>
   Date: 10 Aug 2004
-  Last Modified: 23 May 2006
+  Last Modified: 11 Jun 2006
   Number: 2
-  Version: 43
+  Version: 44
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -629,21 +629,22 @@
 =item *
 
 The context in which a subscript is evaluated is no longer controlled
-by the sigil either.  Subscripts are always evaluated in scalar context
-when used as a lvalue, and list context when used as a rvalue.
+by the sigil either.  Subscripts are always evaluated in list context.
 
 If you need to force inner context to scalar, we now have convenient
 single-character context specifiers such as + for numbers and ~ for strings.
 Conversely, put parenthesis around the lvalue expression to force inner
 context to list:
 
-    @x[f()]   = g();      # scalar context for f() and g()
-    @x[f()]   = @y[g()];  # scalar context for f(), list context for g()
-    @x[f()]   = @y[+g()]; # scalar context for f() and g()
-
-    (@x[f()]) = g();      # list context for f() and g()
-    (@x[f()]) = @y[g()];  # list context for f() and g()
-    (@x[f()]) = @y[+g()]; # list context for f(), scalar context for g()
+    @x[f()]   =  g();       # list context for f() and g()
+    @x[f()]   = +g();       # list context for f(), scalar context for g()
+    @x[+f()]  =  g();       # scalar context for f() and g()
+                            # -- see S03 for "SIMPLE" lvalues
+
+    @x[f()]   =  @y[g()];   # list context for f() and g()
+    @x[f()]   = +@y[g()];   # list context for f() and g()
+    @x[+f()]  =  @y[g()];   # scalar context for f(), list context for g()
+    @x[f()]   =  @y[+g()];  # list context for f(), scalar context for g()
 
 =item *
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About