Author: audreyt Date: Sat Sep 23 20:48:58 2006 New Revision: 12347 Modified: doc/trunk/design/syn/S04.pod
Log: * S04: Wording and examples cleanup; no semantic changes. Modified: doc/trunk/design/syn/S04.pod ============================================================================== --- doc/trunk/design/syn/S04.pod (original) +++ doc/trunk/design/syn/S04.pod Sat Sep 23 20:48:58 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 19 Aug 2004 - Last Modified: 15 Sep 2006 + Last Modified: 24 Sep 2006 Number: 4 - Version: 39 + Version: 40 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. @@ -869,7 +869,7 @@ Final blocks on statement-level constructs always imply semicolon precedence afterwards regardless of the position of the closing curly. Statement-level constructs are distinguished in the grammar by being -declared in the statement syntactic group: +declared in the C<statement_control> category: macro statement_control:<if> ($expr, &ifblock) {...} macro statement_control:<while> ($expr, &whileblock) {...} @@ -879,8 +879,8 @@ the start of a statement. To embed a statement in an expression you must use something like C<do {...}> or C<try {...}>. - $x = do { given $foo { when 1 {2} when 3 {4} }} + $bar; - $x = try { given $foo { when 1 {2} when 3 {4} }} + $bar; + $x = do { given $foo { when 1 {2} when 3 {4} } } + $bar; + $x = try { given $foo { when 1 {2} when 3 {4} } } + $bar; The existence of a C<< statement_control:<BEGIN> >> does not preclude us from also defining a C<< prefix:<BEGIN> >> that I<can> be used within an expression: @@ -895,7 +895,7 @@ You could also conceivably define a C<< prefix:<if> >>, but then you may not get what you want when you say: - .print if $foo; + die if $foo; since C<< prefix:<if> >> would hide C<< statement_modifier:<if> >>.