Author: lwall
Date: 2010-03-03 06:01:30 +0100 (Wed, 03 Mar 2010)
New Revision: 29928

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] clarify the way Pair.ACCEPTS uses "so" and "not" semantics


Modified: docs/Perl6/Spec/S03-operators.pod
===================================================================
--- docs/Perl6/Spec/S03-operators.pod   2010-03-03 03:25:06 UTC (rev 29927)
+++ docs/Perl6/Spec/S03-operators.pod   2010-03-03 05:01:30 UTC (rev 29928)
@@ -16,7 +16,7 @@
     Created: 8 Mar 2004
 
     Last Modified: 2 Mar 2010
-    Version: 195
+    Version: 196
 
 =head1 Overview
 
@@ -2579,13 +2579,25 @@
 
 is the same as
 
-    if $filename.IO.e { say "exists" }
+    if so $filename.IO.e { say "exists" }
 
+Likewise
+
+    if $filename.IO ~~ :!e { say "exists" }
+
+is the same as
+
+    if not $filename.IO.e { say "exists" }
+
 The 1st form actually translates to the latter form, so the object's
 class decides how to dispatch methods.  It just happens that the
 C<IO> role defaults to the expected filetest semantics, but C<$regex.i> might
-tell you whether the regex is case insensitive, for instance.
+tell you whether the regex is case insensitive, for instance.  Likewise,
+you can test anything for definedness or undefinedness:
 
+    $obj ~~ :defined
+    $obj ~~ :!defined
+
 Using the pattern form, multiple tests may be combined via junctions:
 
     given $handle {
@@ -2604,7 +2616,8 @@
     when :r & :w & :x
     when all(:r,:w,:x)
 
-The pair forms are useful only for boolean tests, so the
+The pair forms are useful only for boolean tests because the method's
+value is evaluated as a boolen, so the
 method form must be used for any numeric-based tests:
 
     if stat($filename).s > 1024 {...}

Reply via email to