Author: autrijus
Date: Mon May  1 01:33:08 2006
New Revision: 9051

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

Log:
* S04: minor typo cleanup.
* S04: Document a consequence caused by the statement-terminating
       end-of-line block rule:

    # Without the trailing comma, this becomes a code block
    my $hash = {
        1 => { 2 => 3, 4 => 5 },
    };

  In other words, nested hash literals in other hash literals
  must _not_ be statement-ending. 

Modified: doc/trunk/design/syn/S04.pod
==============================================================================
--- doc/trunk/design/syn/S04.pod        (original)
+++ doc/trunk/design/syn/S04.pod        Mon May  1 01:33:08 2006
@@ -121,7 +121,7 @@
 =head1 Statement-ending blocks
 
 A line ending with a closing brace "C<}>", followed by nothing but
-whitespace or comments, will terminates statement if an end of statement
+whitespace or comments, will terminate a statement if an end of statement
 can occur there.  That is, these two statements are equivalent:
 
     my $x = sub { 3 }
@@ -135,6 +135,13 @@
         sub { 3 }   # the statement won't terminate here 
     ];
 
+However, a nested hash block must be disambiguated by a trailing comma:
+
+    # Without the trailing comma, this becomes a code block
+    my $hash = {
+        1 => { 2 => 3, 4 => 5 },
+    };
+
 Because subroutine declarations are expressions, not statements,
 this is now invalid:
 

Reply via email to