[wg-camlp4] My uses of syntax extension
Hongbo Zhang
hongboz at seas.upenn.edu
Mon Jan 28 21:41:25 GMT 2013
On Mon, Jan 28, 2013 at 12:55 PM, Alain Frisch <alain at frisch.fr> wrote:
> On 01/28/2013 06:13 PM, David Waern wrote:
>
>> OK. I've also wanted similar syntax, but I've noticed that if Alain's
>> "static exceptions" [1] proposal is accepted then encoding such things
>> using existing OCaml syntax becomes a bit lighter:
>>
>> try raise (`Cont expr) with
>> | `Cont n -> expr
>> | handlers
>>
>
> As a side note, this encoding with static exceptions is also much more
> efficient (no allocation required to escape from the exception handler).
>
> I second this suggestion , this is so useful that I can not live without it
> 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
>
>
> -- Alain
>
> ______________________________**_________________
> wg-camlp4 mailing list
> wg-camlp4 at lists.ocaml.org
> http://lists.ocaml.org/**listinfo/wg-camlp4<http://lists.ocaml.org/listinfo/wg-camlp4>
>
--
-- Regards, Hongbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130128/83ae2c7d/attachment.html>
More information about the wg-camlp4
mailing list