Conversation
e32351f to
524a1aa
Compare
|
The history is not as clean as I would like, but we believe that the code is ready for review. I hope to rebase the PR later and clean the history in passing. Below are two remarks that I wrote on the implementation. . We distinguish the notion of "unboxability" (of type definitions) and Ideally, the typedecl_separability module would never depend on . There is a strange duplication between
I thought about this, and I don't see any way to do better than having |
|
(cc @damiendoligez, @yallop and @Armael; you might be interested in this PR) |
|
Don't count on me for this one, I won't have much time until a couple months. |
typing/typedecl_separability.mli
Outdated
| separability cannot be established. *) | ||
|
|
||
| type mode = Types.Separability.t = Ind | Sep | Deepsep | ||
| (** The mode [Sep] ("separable") is used on type expressions that must be |
There was a problem hiding this comment.
The comment phrases the mode as a requirement on arguments ("type expressions that must be separable"), and that's generally how it's used. But I'd prefer to see it defined more neutrally somewhere as a description of type expressions. One option is to document Types.Separability.t as a (representation of a) property of type expressions, and separately document Typedecl_separability.mode as a requirement on arguments, as it is currently.
There was a problem hiding this comment.
I rewrote this comment to include for each mode, then the type-expression view, and then the type-parameter view. I think the latter is necessary to give intuition (type expressions themselves, at the toplevel, must all be separable).
|
@yallop: thanks! I fixed the easy issues, changes for the other are yet to come. |
0211e96 to
f9c6b26
Compare
|
I rebased the PR history, it reads like a novel now. (cc @rlepigre) |
|
@gasche: A bestseller for sure! |
15c348c to
a018864
Compare
|
I rebased against the current trunk and finished taking into accounts the comments of @yallop's first review pass. Thanks! |
a018864 to
5e74e19
Compare
|
(cc @let-def, who seemed interested in our presentation of this work at JFLA 2019.) (Jeremy, it's not clear to me whether you are satisfied with the PR as it is proposed.) |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks good except for a few nitpicks.
let-def
left a comment
There was a problem hiding this comment.
I am not done reviewing this PR, but I already have a few minor remarks.
|
I am in the progress of rebasing this PR on trunk (it requires a bit of work). Please keep sending the good review comments in the meantime :-) |
Thanks for taking care of that @gasche. I don't have much time currently, but is there anything I can help with? |
0987527 to
bbf373f
Compare
|
I just finished rebasing on trunk and pushed to this branch. @rlepigre: Thanks! I'm happy with dealing with the mostly local/form comments so far, but we can definitely discuss it if more ambitious changes are requested by reviewers. |
|
how's this PR going? |
|
After @smuenzel-js's ping, @damiendoligez started to review again (I think he hasn't validated his last review so his comments do not show up). We discussed the non-principality issue together (to me this is the last standing issue that required a discussion). Non-principality shows up for types such as type ('a, 'b) almost_eq =
| Almost_refl : 'c -> ('c, 'c) almost_eqwith (at least) two parameters We decided that there was, in fact, a more natural choice among the two options: it is more natural to constrain the first/leftmost type parameter more, and to let the second be I just pushed a last commit to the PR that enforces this ordering, by processing GADT equations from left to right. |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks good to me, modulo a few nitpicks.
typing/typedecl_separability.mli
Outdated
| In general, the analysis performs a fixpoint computation. It is somewhat | ||
| similar to what is done for inferring the variance of type parameters. | ||
|
|
||
| Our analysis is defined using inference rules "Def; Gamma |- t : m", in |
There was a problem hiding this comment.
Strictly speaking, Def; Gamma |- t : m is a statement, not an inference rule.
65d31e3 to
47590a0
Compare
|
@damiendoligez thanks, I took your suggestions into account and updated the branch. |
47590a0 to
22493b0
Compare
|
I just rebased on trunk again, this should be good to merge once the CI is happy. |
… information In the future, we could move the arity-related checks (one constructor, one parameter) and error logic from typedecl.ml to typedecl_separability.ml.
(this changes the .cmi format and thus requires a bootstrap, to follow as a separate commit) (includes bug fixes by Rodolphe Lepigre)
22493b0 to
e0850a8
Compare
Because this changes the separability of standard library types, and those separabilities are stored in the .cmi files, this commit changes the .cmi files in the standard libraries in way that appear to require a bootstrap (it looks like some part of the stdlib is built with boot/ocamlc and others with ocamlc, and the two should produce/expect the same .cmi exactly). The bootstrap will come as a separate commit.
e0850a8 to
e940f92
Compare
The separability signature of a type declaration is not inferred in
a principal way, it depends on the order in which GADT equations are
processed. In non-principal cases, we may have two parameters that are
related by an equality, with one of them being given mode Ind and the
other Sep. Either choice of which to make Sep is sound, but (Ind, Ind)
would be unsound.
We change the implementation to ensure that equations are processed in
an order such that the lefmost parameters are the most constained: if
equations imply that ('a = 'b), with the parameter 'a coming before 'b
in the type declaration, and they must be separable, then 'a gets the
mode Sep and 'b gets the mode Ind. This corresponds intuitively to
remembering that 'b is equal to a previous parameter, instead of
remembering than 'a is equal to a not-seen-yet parameter.
|
It seems that commit 358c7ce breaks trunk The problem is very easy to reproduce. Checkkout the commit mentionned @gasche do you think you'd be able to fix this? FWIW a job on Inria's CI had detected the problem but it seems it didn't |
|
On my machine, the current HEAD of |
|
@gasche can you please have a look to the other-configs job on Inria's CI?
|
|
So there is indeed a CI bug when |
|
I'm starting to understand what is going on, writing it down here. The first thing to understand is that different In the case where Now here is a partial analysis of the (failing) build logs: What I see is that:
At step (4), I don't think that this PR is to blame for this problem, it's rather one of the rare few PRs doing this kind of things (changing cmis), in a funny enough way (depending on configure flags) that it caught the issue. There is missing dependency information in the Makefile, which should notice that utils/misc.mli needs rebuilding as stdlib/map.cmi changed. |
|
I created a new issue, #9291, to discuss the build failure and Makefile dependency issues. I will not discuss it more on the present thread. |
We (@gasche and I) give a new implementation of the unboxability check for single-constructor types, following theoretical investigations presented in our JFLA 2019 paper (which refines the work of @SimonColin as part of an internship with @gasche). Mutually-recursive type definitions can now contain unboxed declarations, which was not the case before.