[wg-camlp4] My uses of syntax extension

Lukasz Stafiniak lukstafi at gmail.com
Mon Jan 28 18:12:38 GMT 2013


On Mon, Jan 28, 2013 at 6:55 PM, Alain Frisch <alain at frisch.fr> wrote:
>
> As a side note, this encoding with static exceptions is also much more
> efficient (no allocation required to escape from the exception handler).
>
> Still, this is a good example.  One might indeed want to use a dedicated
> syntax for this common idiom.  My preference would be for extending the
> official language to support it directly.  If one thinks it is generally
> useful, why not put it in the language itself?  It is not difficult to
> extend OCaml to support it directly.
>
> If the proposal is rejected but we have let-fix operators, one can decide to
> have a -ppx rewriter detecting and rewriting the following form:
>
> let? x = try e1 with p -> e2 in
> e3

In discussion on ocaml-batteries list, a syntax like the above was in
a tie with the syntax I prefer (and which is used in tutorials about
camlp4/camlp5)...


More information about the wg-camlp4 mailing list