Skip to content
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

4.06 support for ppx_deriving 4.2 #156

Merged
merged 6 commits into from
Nov 14, 2017
Merged

4.06 support for ppx_deriving 4.2 #156

merged 6 commits into from
Nov 14, 2017

Conversation

copy
Copy link
Contributor

@copy copy commented Nov 5, 2017

This is a cherry-pick of @gasche changes from #155 to make the driverized version in the master branch work on OCaml 4.06.

This fixes ppx_deriving for jbuilder users when using ppx_deriving with other driverized ppxs. The error message was Error: ppx_type_conv: 'show' is not a supported type type-conv generator.

@copy copy mentioned this pull request Nov 8, 2017
@gasche
Copy link
Contributor

gasche commented Nov 8, 2017

I find it surprising to add conditional-compilation directives to ppx_deriving 4.2, as my understanding was that the 4.2 code structure used ocaml-migrate-parsetree instead of conditional compilation. Are there still existing cppo directives in the 4.2 codebase that I didn't know about, or is your PR re-introducing conditionals that didn't exist before? Is there a solution to 4.06 support using ocaml-migrate-parsetree without conditionals?

@copy
Copy link
Contributor Author

copy commented Nov 8, 2017

The ocaml-migrate-parsetree changes were reverted in #123, after which omp was only used to register this ppx for jbuilder. The rationale was discussed in #130.

@copy
Copy link
Contributor Author

copy commented Nov 10, 2017

By the way, this branch also works for ocamlbuild users (and I assume users of other build tools as well). Only adding JaneStreet's ppxs to the mix seems to cause problems.

@gasche
Copy link
Contributor

gasche commented Nov 13, 2017

Update: I worked more on 4.05 support in ppx_deriving (inspired by the ppx_deriving_yojson work) and hope to send a PR tonight. Then the current PR would have to be adapted (add more commits).

Independently, I convinced myself that trusting @copy here cannot hurt: the code is not worse with the PR merged than it was before, and I'm happy to have his testing contrbutions. So my plan is to merge the PR (when it converged with my 4.05-level changes), and cut a 4.2 maintenance release after that -- if @copy agrees.

copy and others added 4 commits November 14, 2017 12:57
In order to reduce the difference between the 4.1 maintenance branch and
master, revert the old 4.05 fixes and apply the one's from the 4.1
branch instead

This reverts commit b6b02c2.
…g loc`

Since 4.05.0, many base functions on type variables expect located
strings instead of raw strings. This is also the more informative
API -- locations can always be stripped out, but not regained.

I have mixed feelings about the choice of reusing the same function
names with a different API, which sort of enforces conditional
compilation on users as well. On the other hand, this choice was
designed to *reduce* the amount of conditional compilation required by
providing, for all OCaml versions, the right type for many client
usage patterns -- see

  ocaml-ppx/ppx_deriving_yojson#64
@copy
Copy link
Contributor Author

copy commented Nov 14, 2017

So my plan is to merge the PR (when it converged with my 4.05-level changes), and cut a 4.2 maintenance release after that -- if @copy agrees.

Sounds good to me. I've updated the PR accordingly.

@gasche gasche merged commit 1561d8a into ocaml-ppx:master Nov 14, 2017
@gasche
Copy link
Contributor

gasche commented Nov 14, 2017

Thanks! Merged.

As time passes I feel a bit less confident about the 4.1-maintenance branch. There are two things:

  1. You seem to say that 4.2 works fine for many users, and I have been told that some of the driver-side issues (independent from ppx_deriving) have been fixed or are being fixed.
  2. I have second-thoughts about the fact that I merged in the 4.1-maintenance branch some things that are features developed before the 4.2 release. The idea at the time was to "cut before the weird stuff", but I am uncomfortable tagging 4.1.2 (or 4.1.5) something that is not just a bugfix release.

I am hesitating between dropping the 4.1-maintenance idea completely, or releasing the branch as-is (4.1.5), or removing the new features that I cherry-picked in it to do an actual minor release (4.1.2).

@gasche
Copy link
Contributor

gasche commented Nov 14, 2017

(My short-term plan is to test master on my machine and see whether I can at least build the external plugins from it.)

@gasche
Copy link
Contributor

gasche commented Nov 17, 2017

I tested the current master on my machine, in the sense that I used it to run the make test targets of the corresponding ppx_deriving projects (protobuf, yojson) and they seems to work just fine. I will make a maintenance release of 4.2, and wait to see feedback from user to know whether I still need a 4.1 release as well.

gasche added a commit to gasche/opam-repository that referenced this pull request Nov 21, 2017
This is a minor release on top of 4.2 (instead of a minor release on
top of 4.1 as was originally discussed). The goal is to release this
first, ask user feedback on whether it solves their issues, and make
a 4.1 maintenance release if the issues with driverification are still
there.

The changelog is as follows

  * Add support for OCaml 4.06.0
    ocaml-ppx/ppx_deriving#154, ocaml-ppx/ppx_deriving#155, ocaml-ppx/ppx_deriving#156, ocaml-ppx/ppx_deriving#159
    (Gabriel Scherer, Fabian, Leonid Rozenberg)
  * Consider { with_path = false } when printing record fields
    ocaml-ppx/ppx_deriving#157
    (François Pottier)
gasche added a commit to gasche/opam-repository that referenced this pull request Nov 21, 2017
This is a minor release on top of 4.2 (instead of a minor release on
top of 4.1 as was originally discussed). The goal is to release this
first, ask user feedback on whether it solves their issues, and make
a 4.1 maintenance release if the issues with driverification are still
there.

The changelog is as follows

  * Add support for OCaml 4.06.0
    ocaml-ppx/ppx_deriving#154, ocaml-ppx/ppx_deriving#155, ocaml-ppx/ppx_deriving#156, ocaml-ppx/ppx_deriving#159
    (Gabriel Scherer, Fabian, Leonid Rozenberg)
  * Consider { with_path = false } when printing record fields
    ocaml-ppx/ppx_deriving#157
    (François Pottier)
gasche added a commit to gasche/opam-repository that referenced this pull request Nov 25, 2017
4.1.5 is a maintenance release to include support for OCaml 4.05 and
OCaml 4.06 in the ppx_deriving 4.1 branch, which does not contain the
driverization work that has been causing issues for some users.

  * Add support for OCaml 4.05.0 and 4.06.0 (ocaml-ppx/ppx_deriving#154, ocaml-ppx/ppx_deriving#155, ocaml-ppx/ppx_deriving#156, ocaml-ppx/ppx_deriving#159).
  * Consider { with_path = false } when printing record fields (ocaml-ppx/ppx_deriving#157).
  * Fix comparison order of fields in records (ocaml-ppx/ppx_deriving#136).
  * Silence an `unused rec flag` warning in generated code (ocaml-ppx/ppx_deriving#137).
  * Monomorphize comparison function for builtin types (ocaml-ppx/ppx_deriving#115)
  * Raise an error when `type nonrec` is encountered (ocaml-ppx/ppx_deriving#116).
  * Display an error message when dynamic package loading fails.
  * Add a `with_path` option to `@@deriving` to skip the module path
    in generated code (ocaml-ppx/ppx_deriving#120).
kit-ty-kate added a commit to kit-ty-kate/opam-repository that referenced this pull request Oct 26, 2020
CHANGES:

5.0 (26/10/2020)
----------------

* Migrate to ppxlib ocaml-ppx/ppx_deriving#206, ocaml-ppx/ppx_deriving#210
  (Anton Kochkov, Gabriel Scherer, Thierry Martinez)

4.5
---

* Add support for OCaml 4.11.
  - `Ppx_deriving.string_of_{constant,expression}_opt` to destruct
    `Pconst_string` in a version-independent way
  ocaml-ppx/ppx_deriving#220, ocaml-ppx/ppx_deriving#222
  (Kate Deplaix, Thierry Martinez, review by Gabriel Scherer)

* Stronger type equalities in `Ppx_deriving_runtime` (for instance,
  `Ppx_deriving_runtime.result` and `Result.result` are now compatible with
  all OCaml versions)
  ocaml-ppx/ppx_deriving#223, ocaml-ppx/ppx_deriving#225
  (Thierry Martinez, review by Gabriel Scherer)

* `Ppx_deriving_runtime.Option` compatibility module
  ocaml-ppx/ppx_deriving#222
  (Thierry Martinez, review by Gabriel Scherer)

4.4.1
-----

* Add support for OCaml 4.10
  ocaml-ppx/ppx_deriving#211
  (Kate Deplaix, review by Gabriel Scherer)

4.4
---

* Restore support for OCaml 4.02.3
  ocaml-ppx/ppx_deriving#188
  (ELLIOTTCABLE)
* workaround Location.input_filename being empty
  when using reason-language-server
  ocaml-ppx/ppx_deriving#196
  (Ryan Artecona)
* Add support for OCaml 4.08.0
  ocaml-ppx/ppx_deriving#193, ocaml-ppx/ppx_deriving#197, ocaml-ppx/ppx_deriving#200
  (Gabriel Scherer)

4.3
---

* use Format through Ppx_deriving_runtime to avoid deprecation warning
  for users of JaneStreet Base
  (Stephen Bastians and Gabriel Scherer, review by whitequark)
* silence a ambiguous-field warning (41) in generated code
  ocaml-ppx/ppx_deriving#163
  (Étienne Millon, review by Gabriel Scherer)
* use dune
  ocaml-ppx/ppx_deriving#170
  (Rudi Grinberg, Jérémie Dimino)
* silence an unused-value warning for show
  ocaml-ppx/ppx_deriving#179
  (Nathan Rebours)

4.2.1
-----

  * Add support for OCaml 4.06.0
    ocaml-ppx/ppx_deriving#154, ocaml-ppx/ppx_deriving#155, ocaml-ppx/ppx_deriving#156, ocaml-ppx/ppx_deriving#159
    (Gabriel Scherer, Fabian, Leonid Rozenberg)
  * Consider { with_path = false } when printing record fields
    ocaml-ppx/ppx_deriving#157
    (François Pottier)

4.2
---

  * Add support for OCaml 4.05.0.
  * Use the `ocaml-migrate-parsetree` library to support multiple
    versions of OCaml.
  * Fix comparison order of fields in records (ocaml-ppx/ppx_deriving#136).
  * Silence an `unused rec flag` warning in generated code (ocaml-ppx/ppx_deriving#137).
  * Monomorphize comparison function for builtin types (ocaml-ppx/ppx_deriving#115)
  * Raise an error when `type nonrec` is encountered (ocaml-ppx/ppx_deriving#116).
  * Display an error message when dynamic package loading fails.
  * Add a `with_path` option to `@@deriving` to skip the module path
    in generated code (ocaml-ppx/ppx_deriving#120).

The homepage for the project has now moved to:
<https://github.com/ocaml-ppx/ppx_deriving>

4.1
---

  * Fix type error with inheritied polymorphic variant type in
    [@@deriving map].
  * Fix incorrect handling of multi-argument constructors in
    [@@deriving show].
  * Add API hooks for ppx_type_conv.

4.0
---

  * Show, eq, ord, map, iter, fold: add support for `Result.result`.
  * Ppx_deriving.Arg: use Result.result instead of polymorphic variants.
  * Ppx_deriving.sanitize: parameterize over an opened module.
  * Add support for `[@@deriving]` in module type declarations.
  * Add support for loading findlib packages instead of just files in
    ppx_deriving_main.
  * Treat types explicitly qualified with Pervasives also as builtin.
  * Compatibility with statically linked ppx drivers.

3.1
---

  * Show, eq, ord: hygienically invoke functions from referenced modules
    (such as X.pp for X.t when deriving show) to coexist with modules
    shadowing ones from standard library.
  * Iter, map, fold: hygienically invoke List and Array functions.

3.0
---

  * Implement hygiene: Ppx_deriving.{create_quoter,quote,sanitize,with_quoter}.
  * Show, eq, ord: add support for `lazy_t`.
  * Add support for `[@nobuiltin]` attribute.
  * Add Ppx_deriving.hash_variant.
  * Remove allow_std_type_shadowing option.
  * Remove Ppx_deriving.extract_typename_of_type_group.

2.1
---

  * Fix breakage occurring with 4.02.2 w.r.t record labels
  * Fix prefixed attribute names (`[@deriving.foo.attr]` and `[@foo.attr]`).
  * Add allow_std_type_shadowing option for eq and show.

2.0
---

  * Add support for open types.

1.1
---

  * New plugin: create.
  * Show, eq, ord: handle `_`.
  * Show, eq, ord, map, iter, fold: handle inheriting from a parametric
    polymorphic variant type.
  * Make `Ppx_deriving.poly_{fun,arrow}_of_type_decl` construct functions
    in correct order. This also fixes all derivers with types with
    more than one parameter.
  * Add `Ppx_deriving.fold_{left,right}_type_decl`.

1.0
---

  * Make deriver names lowercase.
  * Remove Findlib+dynlink integration. All derivers must now be
    explicitly required.
  * Allow shortening [%derive.x:] to [%x:] when deriver x exists.
  * Make `Ppx_deriving.core_type` field optional to allow ignoring
    unsupported [%x:] shorthands.
  * Add support for [@@deriving foo { optional = true }] that does
    not error out if foo is missing, useful for optional dependencies.
  * Rename ~name and ~prefix of `Ppx_deriving.attr` and
    `Ppx_deriving.Arg.payload` to `~deriver`.
  * Renamed `Ppx_deriving.Arg.payload` to `get_attr`.
  * Add `Ppx_deriving.Arg.get_expr` and `get_flag`.

0.3
---

  * Show, Eq, Ord, Iter, Fold: handle ref.
  * Show: handle functions.
  * Show: include break hints in format strings.
  * Show: pull fprintf into local environment.
  * Show: add `[@polyprinter]` and `[@opaque]`.
  * Add `Ppx_deriving.Arg.expr`.

0.2
---

  * New plugins: Enum, Iter, Map, Fold.
  * All plugins: don't concatenate affix if type is named `t`.
  * Add `[%derive.Foo:]` shorthand.
  * Show, Eq, Ord: add support for list, array, option.
  * Show: include full module path in output, including for types with manifest.
  * A lot of changes in `Ppx_deriving interface`.

0.1
---

  * Initial release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants