New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-dsource prints uninterpreted syntax extensions incorrectly #6464
Comments
Comment author: @lpw25 This appears to have been fixed by #6377. It now prints:
However, this raises an interesting issue about the automatic conversion of:
into a Pstr_eval. It means the extension node is in an unexpected place. For example, by naming the result
More generally, this conversion is a bit unexpected and likely to cause mistakes in peoples AST transformers (-ppx). Does anybody know why this conversion is done? |
Comment author: @whitequark I think let _ = .. is just syntax for Pstr_eval? As in, there is no automatic conversion. Either way, I wrote a lot of ppx extensions and this was never an issue to me. |
Comment author: @lpw25
The more natural representation would be:
If you wanted to write a ppx that provided a "let%foo" syntax for top-level phrases, and naturally wrote it to detect Pstr_value, then it would not work for:
If you then added support for Pstr_eval to handle this case, then it would also apply to:
which may well not be what you want. In general, any syntactic sugar carried out by the parser makes it more difficult for ppx transformers to apply to the syntax that they are intended for. |
Comment author: @Drup I agree with lpw25. lwt's ppx is affected by this bug (we replace top level let%lwt by a call to "Lwt_main.run". |
Comment author: @whitequark Hm, and I wrote that part of lwt's ppx. Guess I was wrong. |
Comment author: @damiendoligez To summarize, the original bug is fixed by #6377 and now we have a new one: the parser should not turn |
Comment author: @lpw25
I've attached a patch against 4.02 to fix this |
Comment author: @alainfrisch The special case is gone ( 01bf671 ). |
Original bug ID: 6464
Reporter: @whitequark
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2017-02-16T14:16:16Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.0+dev
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Related to: #6865
Monitored by: @Drup
Bug description
I.e. it prints
instead of
Seems to be a leftover from earlier syntax.
File attachments
The text was updated successfully, but these errors were encountered: