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
Unify toploop.mli / opttoploop.mli #10061
Conversation
This unifies both implementations of the toplevel under a common interface. Similar Makefile hacks to those in place for dynlink are used: byte and native implementations are in separate directories, while the shared interface are in the parent and copied as needed by the build rules. This is a preliminary step to remove duplication as much as possible in the two implementations, but should already be pretty useful for libraries that use the `Toploop` interface.
Naive question: could we define the interface in a |
That would make sense if we planned to keep the opttop* modules. However, the end goal is to have a single set of modules and get rid of the opttop* ones. |
So, if I understand correctly, the Makefile blurb is here only for a transitory period, and will be un-complexified after the code has been factorized appropriately? The plan is that, in the end, there is a single module that uses a dynamic check/option to behave as either the bytecode or native toplevel? |
Yes, this is a first stage in merging as much as possible from the On the outside, having a unified interface should already be an improvement though. And quite a few upgrades of the bytecode toplevel are being ported to the native one as it goes, so that's a benefit as well. |
the source file location path changed...
Either dynamic tests, either a module with a different implementation in byte code and native. The first option is simpler to implement, but it means that you'd end up linking the native compilation backend in byte code programs using the toplevel API, which is slightly odd. |
One question regarding the Another option would be to systematically have a |
Indeed, in the current state of the PR, the
This is what I have been doing in the current version for the As for the |
Ack. Let's make it shared with a dummy implementation for native; it's more uniform and it will make things easier for consumers.
Sounds good |
Copying the file separately causes issues (there would be two paths to build `toplevel/byte/toploop.cmi`); this feels a bit cleaner, but the rules are not guarded anymore; it is ok because of the dependency rules ensuing from our `beforedepend` rule.
We just had another look with @AltGr. Just need to fix CI issues and add a disclaimer in |
We need a changelog entry BTW. There is one visible change: modules of the opttoplevel library are renamed |
All looking good from my point of view! @AltGr could you confirm you are happy with the current state of the PR? I'll merge if yes. |
Yep! Still some work to do to clean up the code duplication, but this is fine as a first step forward :) |
Great, merging! |
This follows from ocaml#10061 by renaming the library to further unify the two toplevels. Some remaining references to `Opttop*` have also been cleaned up.
This follows from ocaml#10061 by renaming the library to further unify the two toplevels. Some remaining references to `Opttop*` have also been cleaned up.
This follows from #10061 by renaming the library to further unify the two toplevels. Some remaining references to `Opttop*` have also been cleaned up.
This unifies both implementations of the toplevel under a common interface. Similar Makefile hacks to those in place for dynlink are used: byte and native implementations are in separate directories, while the shared interface are in the parent and copied as needed by the build rules. This is a preliminary step to remove duplication as much as possible in the two implementations, but should already be pretty useful for libraries that use the `Toploop` interface.
This follows from ocaml#10061 by renaming the library to further unify the two toplevels. Some remaining references to `Opttop*` have also been cleaned up.
This unifies both implementations of the toplevel under a common interface.
Similar Makefile hacks to those in place for dynlink are used: byte
and native implementations are in separate directories, while the
shared interface are in the parent and copied as needed by the build
rules.
This is a preliminary step to remove duplication as much as possible
in the two implementations, but should already be pretty useful for
libraries that use the
Toploop
interface.