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

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

August 15, 2006 08:52
[svn:perl6-synopsis] r10971 - doc/trunk/design/syn
Message ID:
Author: larry
Date: Tue Aug 15 08:52:46 2006
New Revision: 10971


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 <>
   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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About