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 <[EMAIL PROTECTED]>
   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

Reply via email to