You can now put arbitrary expressions in patterns by $(expr). The parens are required because I got lazy and didn't bother with fiddling precedences.
A simple example: var x = 20; var a = 20; match a with | $(x) => println$ 20; | ?b => println$ "Got " b.str; endmatch; match (1,2,3) with | (1,$(1+1),3) => println "YES"; endmatch; The purpose of this is: match errno with | $(ENOMEM) => .... etc, where ENOMEM is a const, rather than a constructor. This is the same as match errno with | ?x when x == ENOMEM => ... but a bit terser. It might be fun to change it to $=(ENOMEM) because that might allow $\&(BITMASK) i.e. checking if a bit mask selects any bits. Or something .. :) Note the type of the expression must have an equality operator. Although any expression is allowed, you cannot use it in ranges like: | 10 .. 20 => because these require literals. Matches are a pain because they're translated to if/then/else chain before binding so the types of things aren't known. The kind of match done is driven entirely by syntax. For ranges, there's a new possibility though: if we just require operator < there's no reason | expr .. expr couldn't work: the generated code is the same for any range. Perhaps even more general, sets: | regexp "blah" translates to match_arg in regexp "blah" This would work for any "set", that is, anything with a "mem" operator. Of course you can now just do: | ?x when x in set It might be useful to have a way to name the match argument. -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language