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

Add compat module. #4

Merged
merged 3 commits into from Apr 14, 2023
Merged

Add compat module. #4

merged 3 commits into from Apr 14, 2023

Conversation

toots
Copy link
Member

@toots toots commented Mar 29, 2023

This PR adds a new internal, non-public library. This library should provide a backward-compatible API so that all projects using camomile pre-2.0.0 API can use it if needed. We want to encourage user to migrate to the new API so the library is only provided as example and not as public package.

@Alizter
Copy link

Alizter commented Apr 2, 2023

I think that this is a good idea since there will necessarily be projects that will not update to camomile 2.0.0 and it will be up to package maintainers to keep comparability. Having a dedicated compat module is a much less invasive strategy than maintaining a series of patches.

@toots toots marked this pull request as ready for review April 2, 2023 15:55
@toots
Copy link
Member Author

toots commented Apr 2, 2023

I think that this is a good idea since there will necessarily be projects that will not update to camomile 2.0.0 and it will be up to package maintainers to keep comparability. Having a dedicated compat module is a much less invasive strategy than maintaining a series of patches.

Just pushed an update that should make the compat update totally transparent. Just replace any use of the camomile package with camomile-compat and your code should compile with deprecation warnings.

Could you confirm? I'm ready to release this.

@Alizter
Copy link

Alizter commented Apr 3, 2023

I haven't been able to confirm this yet, but I will ASAP.

@Alizter
Copy link

Alizter commented Apr 3, 2023

So I was testing liquidsoap 2.1.4 and I get:

File "configure.mli", line 36, characters 30-68:
36 | module CamomileCharEncoding : CamomileLibrary.CharEncoding.Interface
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module CamomileLibrary

ah whoops nevermind. I just realised I need to patch camomile to be camomile-compat.

@toots
Copy link
Member Author

toots commented Apr 4, 2023

So I was testing liquidsoap 2.1.4 and I get:

File "configure.mli", line 36, characters 30-68:
36 | module CamomileCharEncoding : CamomileLibrary.CharEncoding.Interface
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module CamomileLibrary

ah whoops nevermind. I just realised I need to patch camomile to be camomile-compat.

Yes, the diff is annoying but that's because our build system pre-dune is also annoying :-)

It's here: https://gist.github.com/toots/ca314c1829c729ff4384d3c500ef8f6b

@Alizter
Copy link

Alizter commented Apr 11, 2023

@toots Is there anything left for this?

@toots
Copy link
Member Author

toots commented Apr 11, 2023

After some thinking, I'm a little hesitant to release a compat module actually.

My original thought was that, without a compat module, there is no way to build all the modules depending on the old camomile API.

However, this also comes at the same time as the new 5.0.0 OCaml compiler also had a new, incompatible API. In fact, the new Camomile release was developed because it wasn't compiling with OCaml 5.0.0.

In other words, all the projects currently broken because they do not support the new camomile API are, in fact, broken because they do not support the new compiler API.

For this reason, there doesn't seem to be a pressing need to provide a compat module from a usability perspective.

The argument against a compat module, on the other hand, is that, once it is provided, it will be carried for a while, kicking down the road the issue of fixing unrelated code that, eventually, needs to be updated.

So, I'd rather use the opportunity of the global OCaml 5.0.0 API breakage to rip the bandaid right now, leave the new API in place and provide good documentation on how to adapt to it.

This would include, I believe, the code for the compat module, which could be provided as an example but not in the official API.

@Alizter
Copy link

Alizter commented Apr 11, 2023

Very well, in that case we can turn the compat API here into a migration guide for people looking to port their libraries.

@toots
Copy link
Member Author

toots commented Apr 12, 2023

Very well, in that case we can turn the compat API here into a migration guide for people looking to port their libraries.

Exactly! I'll push that shortly!

@toots
Copy link
Member Author

toots commented Apr 13, 2023

@Alizter I added an entry in the README.md. What do you think of it?

Copy link

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toots toots merged commit 9ce6174 into main Apr 14, 2023
6 checks passed
@toots toots deleted the compat branch April 14, 2023 00:54
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.

None yet

2 participants