-
Notifications
You must be signed in to change notification settings - Fork 98
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
Bias the mapping from magic to version towards the current version #409
Conversation
Thanks, @shym! Does it sound good to you to add a changelog entry? Alternatively, I can write it and it and push it to your branch. |
When mapping from magic numbers to versions, first check whether it is the current version, which is probably the most common case It has the added benefit that, when the mapping is ambiguous (mostly between the latest stable release and the development version), this strategy makes the good choice for the test suite Signed-off-by: Samuel Hym <[email protected]>
I just updated the changelog. I assumed its entries are not sorted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, LGTM! The only nitpick (see below): I'd specify in the changelog that the change is about the driver, since library and driver are mixed in the same package in ppxlib and most user-facing changes are on the library.
CHANGES.md
Outdated
- Bias the mapping from magic to version towards the current version, | ||
as it is usually the common case and it helps when magic numbers are | ||
ambiguous (such as on development versions) (#409, @shym) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Bias the mapping from magic to version towards the current version, | |
as it is usually the common case and it helps when magic numbers are | |
ambiguous (such as on development versions) (#409, @shym) | |
- Driver: Bias the mapping from magic to version towards the current version, | |
as it is usually the common case and it helps when magic numbers are | |
ambiguous (such as on development versions) (#409, @shym) |
Co-authored-by: Sonja Heinze <[email protected]>
Just out of curiosity, is there a case where ppxlib is reading an AST which is not of magic number "Ocaml_current"? In other words, could |
It does happen at least in the test suite, for instance in |
This is the case whenever the PPX executable is compiled with a different OCaml version than the project. So, in particular, that's never the case when people use That being said, I don't think that's a problem for the following reason: on released Ppxlib versions, nothing has changed: released Ppxlib versions are still only compatible with stable compilers, among which the magic numbers are unique. So biasing or not doesn't make a difference in that context. And whenever we are in a context where we allow Ppxlib to be co-installable with |
CHANGES: - Adopt the OCaml Code of Conduct on the repo (ocaml-ppx/ppxlib#426, @pitag-ha) - Clean up misleading attribute hints when declared for proper context. (ocaml-ppx/ppxlib#425, @ceastlund) - Ast_pattern now has ebool, pbool helper, and a new map.(ocaml-ppx/ppxlib#402, @Burnleydev1) - multiple errors are now reported in `metaquot`. (ocaml-ppx/ppxlib#397, @Burnleydev1) - Add `Attribute.declare_with_attr_loc` (ocaml-ppx/ppxlib#396, @dvulakh) - Add "ns" and "res" as reserved namespaces(ocaml-ppx/ppxlib#388, @davesnx) - Make quoter `let` binding non-recursive (ocaml-ppx/ppxlib#401, @sim642) - Fix failure of 'lift_map_with_context' in traverse by compile-time evaluation of 'fst' and 'snd' (ocaml-ppx/ppxlib#390, @smuenzel) - Driver: Bias the mapping from magic to version towards the current version, as it is usually the common case and it helps when magic numbers are ambiguous (such as on development versions) (ocaml-ppx/ppxlib#409, @shym) - Remove unnecessary test dependencies towards base and stdio (ocaml-ppx/ppxlib#421, @kit-ty-kate) - Update description to reflect that `ppxlib` contains more than a library (ocaml-ppx/ppxlib#422, @pitag-ha) - Add support for OCaml 5.1, excluding OCaml `5.1.0~alpha1` (ocaml-ppx/ppxlib#428, @shym, @Octachron , @pitag-ha, @panglesd) - Driver: Fix `-locations-check` option for coercions with ground (ocaml-ppx/ppxlib#428, @Octachron)
CHANGES: - Adopt the OCaml Code of Conduct on the repo (ocaml-ppx/ppxlib#426, @pitag-ha) - Clean up misleading attribute hints when declared for proper context. (ocaml-ppx/ppxlib#425, @ceastlund) - Ast_pattern now has ebool, pbool helper, and a new map.(ocaml-ppx/ppxlib#402, @Burnleydev1) - multiple errors are now reported in `metaquot`. (ocaml-ppx/ppxlib#397, @Burnleydev1) - Add `Attribute.declare_with_attr_loc` (ocaml-ppx/ppxlib#396, @dvulakh) - Add "ns" and "res" as reserved namespaces(ocaml-ppx/ppxlib#388, @davesnx) - Make quoter `let` binding non-recursive (ocaml-ppx/ppxlib#401, @sim642) - Fix failure of 'lift_map_with_context' in traverse by compile-time evaluation of 'fst' and 'snd' (ocaml-ppx/ppxlib#390, @smuenzel) - Driver: Bias the mapping from magic to version towards the current version, as it is usually the common case and it helps when magic numbers are ambiguous (such as on development versions) (ocaml-ppx/ppxlib#409, @shym) - Remove unnecessary test dependencies towards base and stdio (ocaml-ppx/ppxlib#421, @kit-ty-kate) - Update description to reflect that `ppxlib` contains more than a library (ocaml-ppx/ppxlib#422, @pitag-ha) - Add support for OCaml 5.1, excluding OCaml `5.1.0~alpha1` (ocaml-ppx/ppxlib#428, @shym, @Octachron , @pitag-ha, @panglesd) - Driver: Fix `-locations-check` option for coercions with ground (ocaml-ppx/ppxlib#428, @Octachron)
CHANGES: - Adopt the OCaml Code of Conduct on the repo (ocaml-ppx/ppxlib#426, @pitag-ha) - Clean up misleading attribute hints when declared for proper context. (ocaml-ppx/ppxlib#425, @ceastlund) - Ast_pattern now has ebool, pbool helper, and a new map.(ocaml-ppx/ppxlib#402, @Burnleydev1) - multiple errors are now reported in `metaquot`. (ocaml-ppx/ppxlib#397, @Burnleydev1) - Add `Attribute.declare_with_attr_loc` (ocaml-ppx/ppxlib#396, @dvulakh) - Add "ns" and "res" as reserved namespaces(ocaml-ppx/ppxlib#388, @davesnx) - Make quoter `let` binding non-recursive (ocaml-ppx/ppxlib#401, @sim642) - Fix failure of 'lift_map_with_context' in traverse by compile-time evaluation of 'fst' and 'snd' (ocaml-ppx/ppxlib#390, @smuenzel) - Driver: Bias the mapping from magic to version towards the current version, as it is usually the common case and it helps when magic numbers are ambiguous (such as on development versions) (ocaml-ppx/ppxlib#409, @shym) - Remove unnecessary test dependencies towards base and stdio (ocaml-ppx/ppxlib#421, @kit-ty-kate) - Update description to reflect that `ppxlib` contains more than a library (ocaml-ppx/ppxlib#422, @pitag-ha) - Add support for OCaml 5.1, excluding OCaml `5.1.0~alpha1` (ocaml-ppx/ppxlib#428, @shym, @Octachron , @pitag-ha, @panglesd) - Driver: Fix `-locations-check` option for coercions with ground (ocaml-ppx/ppxlib#428, @Octachron)
When mapping from magic numbers to versions, first check whether it is the current version, which is probably the most common case It has the added benefit that, when the mapping is ambiguous (mostly between the latest stable release and the development version), this strategy makes the good choice for the test suite