Repository navigation
Conversation
There was a problem hiding this comment.
Why do we need this here? There should be a tag use_ppx_lwt in _tags with some flag statements in myocamlbuild.ml to add the right -ppx argument.
There was a problem hiding this comment.
I have no idea how to get in myocamlbuild.ml which one of the executables (byte/native) OASIS will build.
There was a problem hiding this comment.
You can access the variables in setup.data with BaseEnvLight.var_get (it is already used in myocamlbuild.ml). You can use the is_native variable to guess whether oasis will build the .byte or .native.
There was a problem hiding this comment.
@Drup Would you please make OASIS jump through the burning ring here? I feel you'll do it better than me.
Initial patch by Drup.
and small grammar/spelling fixes for pa documentation.
|
I rebased, so it's mergeable, and I added the necessary flag to detect byte/native extension for the ppx. |
|
I had a quick look and it seems fine to me. Though I do find the syntax for |
|
@diml No, there is no better syntax, and I completely disagree with disabling it. To begin with, I already have code which uses this feature. Then, right now, the two syntax extensions have 1:1 feature parity. I certainly don't want the ppx one to be inferior. I'm not sure there ever will be better syntax. @alainfrisch? Could we use something else than a fake match case for [%finally]? Currently it looks like |
|
Looking for a nice syntax for a finally statement? What about piggy-backing the syntax for application: (try ... with ...) [%finally ...] (which could also be written with "begin ... end") |
|
It looks really terrible to me ಠ_ಠ Much more so than piggybacking the branch. @diml? |
|
I would rather prefer Alain's suggestion as it makes it clear that the |
|
@gasche I agree; you have a point. Any other suggestions? |
|
I'm fine with @alainfrisch suggestion. I guess one slight disadvantage is that it make it seems that the finally is executed after the |
|
What do we do about Letting it like that make the syntax inconsistent. |
|
Oh, I just realized Alain's suggestion is actually composable, as it piggybacks application syntax. I.e. this way you can "finalize" any expression at all, not just try..with. Now I really like it! I suggest recognizing two forms:
This way, it will be clearly namespaced either way. |
|
Why not just use |
|
@Drup That would be ignored if you forget to include lwt.ppx. |
|
Err, right. If feels slightly wrong. |
|
I implemented the new syntax for finally. I also fixed a small issue with attributes. |
|
@Drup LGTM. |
|
The let e' = try%lwt e with c in
e' [%finally f]So |
|
I don't understand, what do you want to change ? the equivalent of the old |
|
@diml so the one with the right semantics is |
|
@Drup, either don't special case TBH honest I think the old @gasche, In the camlp4 extension, match e with
| x -> f (); (match x with c)
| exception e -> f (); raise eI don't claim that this was the best choice, and I wish I didn't introduced this form. With the new syntax I claim that expanding |
|
@diml Good points. I now see the problem with ordering of |
|
I think you rather mean If retrospectively people agree that this is not a very nice construct, why not just drop it? I understand the desire to be feature-compatible with the camlp4 implementation as a point of principle, and also to help users migrate code, but maybe this is also a good occasion to fix a design mistake. |
Indeed, thanks.
Yes, that's what I'm suggesting. |
|
Done. This changes also makes the code quite simpler. |
|
Merged, thanks! |
So, I think it's ready now. There is still a small opam issue (see ocaml/opam#1572) but we can take care of that later.
@diml : I added documentation and the code is ready to be looked at.
There is annoying point here but there is no clean solution with oasis.
cc @whitequark