Author: larry
Date: Fri Nov  7 10:10:52 2008
New Revision: 14602

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

Log:
recast $?FOO matching in terms of new pair matching syntax


Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Fri Nov  7 10:10:52 2008
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 7 Nov 2008
   Number: 2
-  Version: 141
+  Version: 142
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1981,9 +1981,7 @@
 All the nested C<@?> variables are ordered from the innermost to the
 outermost, so C<@?BLOCK[0]> is always the same as C<&?BLOCK>.
 
-The following return objects that contain all pertinent info; in
-particular they may be smartmatched against strings for the name and
-against version literals for the version:
+The following return objects that contain all pertinent info:
 
     $?OS        Which operating system am I compiled for?
     $?DISTRO    Which OS distribution am I compiling under
@@ -2001,6 +1999,20 @@
     $?GRAMMAR   Which grammar am I in?
     @?GRAMMAR   Which nested grammars am I in?
 
+It is relatively easy to smartmatch these constant objects
+against pairs to check various attributes such as name,
+version, or authority:
+
+    given $?VM {
+        when :name<Parrot> :ver(v2) { ... }
+        when :name<CLOS>            { ... }
+        when :name<SpiderMonkey>    { ... }
+        when :name<JVM> :ver(v6.*)  { ... }
+    }
+
+Matches of constant pairs on constant objects may all be resolved at
+compile time, so dead code can be eliminated by the optimizer.
+
 Note that some of these things have parallels in the C<*> space at run time:
 
     $*OS        Which OS I'm running under

Reply via email to