Author: lwall Date: 2009-11-20 18:43:16 +0100 (Fri, 20 Nov 2009) New Revision: 29153
Modified: docs/Perl6/Spec/S03-operators.pod Log: [S03] add infix:<else> to match infix:<also>, suggested by TheDamian++ Modified: docs/Perl6/Spec/S03-operators.pod =================================================================== --- docs/Perl6/Spec/S03-operators.pod 2009-11-20 17:25:59 UTC (rev 29152) +++ docs/Perl6/Spec/S03-operators.pod 2009-11-20 17:43:16 UTC (rev 29153) @@ -16,7 +16,7 @@ Created: 8 Mar 2004 Last Modified: 20 Nov 2009 - Version: 178 + Version: 179 =head1 Overview @@ -963,12 +963,12 @@ C<< infix:<&> >>, but with left-to-right evaluation guaranteed, for use in guarded patterns: - $target ~~ MyType also .mytest1 also .mytest2 + $target ~~ MyType also *.mytest1 also *.mytest2 This is useful when later tests might throw exceptions if earlier tests don't pass. This cannot be guaranteed by: - $target ~~ MyType & .mytest1 & .mytest2 + $target ~~ MyType & *.mytest1 & *.mytest2 =back @@ -984,6 +984,24 @@ =item * +C<< infix:<else> >>, short-circuit junctional or operator + + EXPR else EXPR else EXPR ... + +Can be used to construct ORed patterns with the same semantics as +C<< infix:<|> >>, but with left-to-right evaluation guaranteed, for use +in guarded patterns where the left argument is much more easily +falsifiable than the right: + + $target ~~ *.mycheaptest else *.myexpensivetest + +This is also useful when you want to perform tests in order +of safety: + + $target ~~ MyType else *.mysafetest else *.mydangeroustest + +=item * + C<< infix:<^> >>, one() operator $a ^ $b ^ $c ...