I recently wrote some ocaml code which "worked", but not as I
intended... The test cases I tried worked, but I should have tested
harder. Apparently I was under the mistaken impression that OCaml's
pattern-matching was more "first class"! So I wrote (in part):
let buildsimp cast e f1 f2 = fun e1 -> fun e2 -> match (e1,e2) with
| ({st = Some e}, _) -> e2
and I expected it to work. Only a code review by a colleague 'found'
this bug in my code.
Question: would it be a difficult extension? This seemed so "natural",
I just "used" the feature before it was quite there yet ;-).
Jacques
PS: I guess I had first-class patterns on the brain; Maple has them
[under the misleadingly-named function "typematch"] (but that's
cheating, I know) and W. Kahl's Pattern Matching Calculus allows it, and
I wrote a joint paper with Wolfram describing a categorical semantics
for the PMC.