Author: masak
Date: 2009-03-14 13:34:42 +0100 (Sat, 14 Mar 2009)
New Revision: 25821

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
specced syntactic 'where' sugar in param lists

Modified: docs/Perl6/Spec/S12-objects.pod
===================================================================
--- docs/Perl6/Spec/S12-objects.pod     2009-03-13 15:44:50 UTC (rev 25820)
+++ docs/Perl6/Spec/S12-objects.pod     2009-03-14 12:34:42 UTC (rev 25821)
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <la...@wall.org>
   Date: 27 Oct 2004
-  Last Modified: 12 Mar 2009
+  Last Modified: 14 Mar 2009
   Number: 12
-  Version: 76
+  Version: 77
 
 =head1 Overview
 
@@ -1305,6 +1305,18 @@
 since all the type constraints in a signature parameter are just
 anded together anyway.
 
+You can leave out the block when matching against a literal value of some
+kind:
+
+    multi sub fib ($n where 0|1) { return $n }
+    multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
+In fact, you can leave out the 'where' declaration altogether:
+
+    multi sub fib (0) { return 0 }
+    multi sub fib (1) { return 1 }
+    multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
 Subtype constraints are used as tiebreakers in multiple dispatch:
 
     use Rules::Common :profanity;

Reply via email to