-
Notifications
You must be signed in to change notification settings - Fork 182
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
First draft on multi-version support #2253
Conversation
I will have a look soon. I'm also interested in having the opinion of @emillon on this design (if you have the bandwidth ofc!), or someone else also having experience on the versioning of OCaml tooling. |
c2ab003
to
e3aaa33
Compare
Sure! But it's probably not very useful if I comment on the implementation. Do you have a description of the problem you're solving and what the approach looks like? |
@emillon The problem we are trying to solve is the following : Some projects don't want to have their formatting change all the time. They use a In the lib folder we have three new folders :
When a newer version is released, we should copy the This approach may seem heavy-handed, and in its current form it is, but I think we get to choose how heavy or light this is going to be by deciding which modules go into the Another advantage to this approach is that it does not care about how each version is implemented, which is a good thing as big changes are planned (switch to PPrint) Currently the parser is not versionned, but it should probably be as the AST is being changed, and this would cause incompatibility later on. |
OK, thanks for the explanation. I think that it's a great problem to solve, that has been there with ocamlformat since I've known about it. Thanks for working on that. Here are some remarks about this approach, which I'll leave up to the ocamlformat dev team to evaluate (though I'm happy to expand on some points). The problem shares some constraints with how We want To do so, dune records the version of the project it is building, and compares that version in various places to determine whether it should do the "old" or the "new" behavior. This sounds bad but in practice it is not a big issue in the context of dune since new behaviors are often added in relation to a new field. So we just tag that the field is added in version X and we don't have anything else to do. Overall, I think that this is working well. Some things I like and were not completely obvious at start:
As for the approach you're suggesting, the concerns I would have are:
Happy to expand on some points if you want more info. |
Thank for the feedback @emillon Sometime caught my attention in particular :
In the context of ocamlformat, when bugs affect formatting we would want to keep them in the old versions. This is not the case of all bugs, a bug that causes a crash would need fixing everywhere. Its true that my design is good for the first case but not the second. Regarding size, the folder that would duplicated is 21M including build artifacts, and the .a file itself is 2M. |
Just out of curiosity, there is another approach that could be considered: version the |
This is a better approach for multiversion support : #2535 |
This a rough draft for multi-version support for ocamlformat.
It use first class modules to pick the specified version of ocamlformat.
There are two main limitations with the design :
I would really like comments on the overall design, I do not think this is ready for merging at all.
If the design of the patch looks good to everyone, then a lot of cleaning up and some testing would be required.