-
Notifications
You must be signed in to change notification settings - Fork 90
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.08 support #193
Merged
Merged
4.08 support #193
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9eaeeba
ppx_deriving_runtime: use 'type nonrec' (since 4.02.2)
gasche b8630d3
remove_pervasives: also remove Stdlib quantification
gasche 11fd867
raise_errof: Location API change
gasche 1948331
4.08 fix: api/ppx_deriving, attribute format change
gasche 7e0faa6
4.08 fix: enum, row_field change
gasche 10542b2
4.08 fix: raise_errorf change
gasche 538daa6
4.08 fix: Rtag fixes everywhere
gasche 16743e0
runtime: use Stdlib starting on 4.07
gasche 305fac2
tests now depend on ppx_deriving.runtime
gasche 569dc37
runtime: add tests for the type equalities we want to enforce
gasche 26a7e95
plugins: use Ppx_deriving.compare instead of Pervasives
gasche a7788f8
silence remaining deprecation warnings in the tests
gasche acd0dcf
Add autobuilds for OCaml 4.08
XVilka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ env: | |
- OCAML_VERSION=4.05 | ||
- OCAML_VERSION=4.06 | ||
- OCAML_VERSION=4.07 | ||
- OCAML_VERSION=4.08 | ||
os: | ||
- linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
(env | ||
(_ | ||
(flags -w -9))) | ||
|
||
(copy_files# src_plugins/compat_macros.cppo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
type nonrec int = int | ||
type nonrec char = char | ||
type nonrec string = string | ||
type nonrec float = float | ||
type nonrec bool = bool | ||
type nonrec unit = unit | ||
type nonrec exn = exn | ||
type nonrec 'a array = 'a array | ||
type nonrec 'a list = 'a list | ||
type nonrec 'a option = 'a option | ||
type nonrec nativeint = nativeint | ||
type nonrec int32 = int32 | ||
type nonrec int64 = int64 | ||
type nonrec 'a lazy_t = 'a lazy_t | ||
type nonrec bytes = bytes | ||
|
||
#if OCAML_VERSION >= (4, 08, 0) | ||
(* We require 4.08 while 4.07 already has a Stdlib module. | ||
In 4.07, the type equalities on Stdlib.Pervasives | ||
are not strong enough for the 'include Stdlib' | ||
below to satisfy the signature constraints on | ||
Ppx_deriving_runtime.Pervasives. *) | ||
module Stdlib = Stdlib | ||
|
||
include Stdlib | ||
#else | ||
module Pervasives = Pervasives | ||
module Stdlib = Pervasives | ||
|
||
module Char = Char | ||
module String = String | ||
module Printexc = Printexc | ||
module Array = Array | ||
module List = List | ||
module Nativeint = Nativeint | ||
module Int32 = Int32 | ||
module Int64 = Int64 | ||
module Lazy = Lazy | ||
module Bytes = Bytes | ||
|
||
module Hashtbl = Hashtbl | ||
module Queue = Queue | ||
module Stack = Stack | ||
module Set = Set | ||
module Map = Map | ||
module Weak = Weak | ||
|
||
module Printf = Printf | ||
module Format = Format | ||
module Buffer = Buffer | ||
module Result = struct | ||
(* the "result" compatibility module defines Result.result, | ||
not Result.t as the 4.08 stdlib *) | ||
type ('a, 'b) t = ('a, 'b) Result.result = | ||
| Ok of 'a | ||
| Error of 'b | ||
|
||
(* ... and we also expose Result.result for backward-compatibility *) | ||
type ('a, 'b) result = ('a, 'b) Result.result = | ||
| Ok of 'a | ||
| Error of 'b | ||
end | ||
|
||
include Pervasives | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So, this is merged and published, so I don't know if this is the best place to raise this — but using
cppo
in the runtime, specifically, is going to cause me … a whole, whole lot of problems over inbs-deriving
land (not in the least, because#if OCAML_VERSION
actually already means something over there — with a different semantic!). )=Not y'all's problem, of course; but before I go try and make my rickety, arcane build-system about ten times as rickety and arcane as it already is … is there any chance there's an easy, alternative way to do this upstream? Since this is the only occurrence in the runtime?
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.
I'm happy to try to make the bs-deriving life easier, but I'm worried that there may not be a very easy way to avoid having two different logics here -- it's solving several delicate problems (deprecation of
Pervasives
, semantics ofinclude
, etc.) and it is actually scoping over most of the runtime definition, not just a small part of it.What would be your recommendation for a conditional-compilation approach that works with both cppo and bspp? Would you avoid all in-file logic and use two different
.ml
, selected by the build system?Maybe it is possible to use both build systems to define one variable (
OCAML_VERSION_GTE_408
), and use a test on that variable in a syntax that is compatible with both preprocessors?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.
Hmmmmmmmmmm. Well, I'd like to avoid "partially upstreaming" bs-deriving (in the sense of making weird changes like adding
OCAML_VERSION_but_not_because_some_other_thing_not_related_to_this_codebase_is_weird
, that you've then gotta document somewhere, test, avoid breaking in the future …)If
OCAML_VERSION
is idiomatic in the way it's used here, I'm not sure what to do; I'm not exactly a high-wizard of OCaml, unfortunately, just a dude gluing some stuff together. Poorly. 🤣Two files might work, but is still teetering on just … upstreaming the maintenance burden. I was mostly, vaguely hoping that “hey! wow! there just happen to be two equally-good ways to do this upstream, and the other one won't be as big a problem for Elliott! Yay!”, but doesn't look like it.
I'm gonna keep this in mind and ruminate on it for a while; maybe I can figure something simple out in the coming weeks. (Thanks for the quick replies, by the way!)
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.
I don't personally mind having some changes in the upstream repo that are solely justified by bs-deriving, especially if they only touch the implementation (so we have to document the code but the end-users will not see a difference). I would keep the extra-maintenance-burden in mind, but maybe there is a way that works and isn't actually that burdensome.
(Yes,
OCAML_VERSION
is used in the idiomatic way here. I think it would have made sense for the Bucklescript people to use the de-facto standard syntax of cppo in their preprocessor syntax, but well...)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.
(Note that I've opened rescript-lang/rescript#3820 about this.)