[e-lang] Negating guards (was ":Foo" pattern syntax)

Kevin Reid kpreid at mac.com
Wed Mar 28 13:58:33 CDT 2007

On Mar 28, 2007, at 12:37, Mark S. Miller wrote:
> Kevin Reid wrote:
>> E-on-Java accepts ":Foo" as a pattern, equivalent to "_ :Foo". E-on-
>> CL does not.
>> Is this syntax archaic or current; i.e. should I add it to E-on-CL or
>> edit the code to not use it?
>> (FWIW, I find it slightly ugly.)
> Unless someone speaks up for it soon, I'm willing to deprecate it.


The uses I've seen so far (runeAuthor.emaker and argParser.emaker)  
are like this:

match x ? (x !~ :String) {
     # XXX An awkward way to say "doesn't coerce to a String"

which in E-on-CL I am patching to be

match x :Not[String] {

where "Not" makes the negated guards that used to be intended to be  
available as "!String".

Observation: there are two possible kinds of negation one might want:  
"doesn't coerce via X" and "is not a result of X", and E-on-CL  
provides the first. The second is useful if, one wants to match no  
actual strings (for example), but allow objects that happen to be  
willing to coerce to strings. The latter can be built out of the  
former as Not[Really[String]], though.

Kevin Reid                            <http://homepage.mac.com/kpreid/>

More information about the e-lang mailing list