Hi,

Alex Shinn <alexsh...@gmail.com> writes:

> The default matcher in Racket is extensible by dispatching
> on the first symbol in each list, so a pair is (cons a b) and a
> list would be (list a b c).  This is slightly more verbose, and
> looks like how you would generate the data rather than its
> actual structure, but at least is extensible.

That’s similar to what OCaml, Coq, Scala, & co. do.  The nice thing is
that it’s expressive and makes for an extensible matcher.

> It would be possible to build on Wright's syntax with a
> single hook, e.g. patterns of the form
>
>   (extended-match match-dispatcher data ...)
>
> possibly abbreviated
>
>   (: match-dispatcher data ...)
>
> where `match-dispatcher' is an extension macro following
> some CPS API.  A kludge, but perhaps better than
> redefining a matcher for every extension.

Sounds like a nice plan.  :-)

Thanks,
Ludo’.


Reply via email to