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

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

From:
larry
Date:
August 15, 2006 08:52
Subject:
[svn:perl6-synopsis] r10971 - doc/trunk/design/syn
Message ID:
20060815155247.9A2B7CB9BB@x12.develooper.com
Author: larry
Date: Tue Aug 15 08:52:46 2006
New Revision: 10971

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

Log:
Clarifications on C<do> with bare expression.


Modified: doc/trunk/design/syn/S04.pod
==============================================================================
--- doc/trunk/design/syn/S04.pod	(original)
+++ doc/trunk/design/syn/S04.pod	Tue Aug 15 08:52:46 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <larry@wall.org>
   Date: 19 Aug 2004
-  Last Modified: 14 Aug 2006
+  Last Modified: 15 Aug 2006
   Number: 4
-  Version: 34
+  Version: 35
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -349,8 +349,15 @@
 
     $x = do if $a { $b } else { $c };
 
-This construct only allows you to prefix a statement.  If you want to
-continue the expression after the statement you must use the curly form.
+This construct only allows you to attach a single statement to the end
+of an expression.  If you want to continue the expression after the
+statement, or if you want to attach multiple statements. you must use
+the curly form.  Since a bare expression may be used as a statement,
+you may use C<do> on an expression, but its only effect is to function
+as an unmatched left parenthesis, much like the C<$> operator in
+Haskell.  That is, precedence decisions do not cross a C<do> boundary.
+Conjectural: a C<do> may be used within a subexpression, but only if
+terminated by an unmatched right bracket of some kind.
 
 Since C<do> is defined as going in front of a statement, it follows
 that it can always be followed by a statement label.  This is particularly



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