Author: larry
Date: Tue Apr 17 11:22:38 2007
New Revision: 14376

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

Log:
Note that unless no longer allows an else
Clarification of binding semantics of if, elsif, and else
Clarification of C<..>. requested by moritz++


Modified: doc/trunk/design/syn/S04.pod
==============================================================================
--- doc/trunk/design/syn/S04.pod        (original)
+++ doc/trunk/design/syn/S04.pod        Tue Apr 17 11:22:38 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 28 Mar 2007
+  Last Modified: 17 Apr 2007
   Number: 4
-  Version: 56
+  Version: 57
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -175,8 +175,8 @@
 
 =head1 Conditional statements
 
-The C<if> and C<unless> statements work almost exactly as they do in
-Perl 5, except that you may omit the parentheses on the conditional:
+The C<if> and C<unless> statements work much as they do in
+Perl 5.  However, you may omit the parentheses on the conditional:
 
     if $foo == 123 {
         ...
@@ -192,6 +192,24 @@
 branch, the return value is C<undef> in item context and C<()> in
 list context.
 
+The C<unless> statement does not allow an C<elsif> or C<else> in Perl 6.
+
+The value of the conditional expression may be optionally bound to
+a closure parameter:
+
+    if    testa() -> $a { say $a }
+    elsif testb() -> $b { say $b }
+    else          -> $b { say $b }
+
+Note that the value being evaluated for truth and subsequently bound is
+not necessarily a value of type Bool.  (All normal types in Perl may
+be evaluated for truth.  In fact, this construct would be relatively
+useless if you could bind only boolean values as parameters, since
+within the closure you already know whether it evaluated to true
+or false.)  Binding within an C<else> automatically binds the value
+tested by the previous C<if> or C<elsif>, which, while known to be
+false, might nevertheless be an I<interesting> value of false.
+
 Conditional statement modifiers work as in Perl 5.  So do the
 implicit conditionals implied by short-circuit operators.  Note though that
 the first expression within parens or brackets is parsed as a statement,

Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod        (original)
+++ doc/trunk/design/syn/S05.pod        Tue Apr 17 11:22:38 2007
@@ -14,9 +14,9 @@
    Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
                Larry Wall <[EMAIL PROTECTED]>
    Date: 24 Jun 2002
-   Last Modified: 31 Mar 2007
+   Last Modified: 17 Apr 2007
    Number: 5
-   Version: 56
+   Version: 57
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I<regex> rather than "regular
@@ -1137,7 +1137,7 @@
 =item *
 
 A leading C<[> or C<+> indicates an enumerated character class.  Ranges
-in enumerated character classes are indicated with C<..>.
+in enumerated character classes are indicated with "C<..>" rather than "C<->".
 
      / <[a..z_]>* /
      / <+[a..z_]>* /

Reply via email to