[racket-dev] racket/match is broken

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed Oct 5 22:48:04 EDT 2011

Okay. I think it is strange, but feel free to do that and revert my
change. Apologies for the confusion.

The use case I was actually doing was like this:

[(list '+ (app parse lhs) (app parse rhs))
[(list 'fun (list (? symbol? arg) ...) (app parse body))

And when you gave it a '(fun () ...) it would try to parse the '() in
the fun as the lhs of a + and then throw an exception and crash the
whole match.


On Wed, Oct 5, 2011 at 7:39 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Wed, Oct 5, 2011 at 5:13 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>> Basically, it calls the app function on the second element of the list
>> even though the head of the list has failed to pattern match.
> This is not a bug.  `match' makes no guarantee about the order in
> which it checks elements of the pattern.  If it were to try to support
> this kind of use case, it would have to specify how many times it
> would call each function that might be embedded in a match, which
> requires a detailed semantics of backtracking in the matcher, and lock
> in a particular implementation.
> I will clarify the documentation to say that you shouldn't use
> functions that aren't safe to call 0, 1, or more times, in various
> orders, inside `match' patterns.
> --
> sam th
> samth at ccs.neu.edu

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.