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
Update compatibility.h with Caml_state #9014
Comments
@gasche I think you can put your consider-for-release sticker on this one |
A small note for reproducing: I came up with the list by looking up occurrences of the previous domain state field names ( |
Would @kayceesrk or someone else have time to look at this. |
Patch in #9115 |
I didn't have time to test yet |
Does this mean "base" contains C files that still uses the old function names for the FFI ? It is time to switch to the new names. |
I don't think
This links against an unexported variable inside the OCaml runtime, which no longer exists. Fixing this will require changing Incidentally, this function in
This is quite sensible behaviour: perhaps raise_notrace should always work like this? |
@stedolan one potential issue is that I may want to use |
(It would be nice if advanced users of backtraces would report their wishes and needs upstream, so that we learned about them and could design better solutions before the moment where their code breaks because it uses internal details of an API we changed.) |
(copied from #9115 (comment) as the present issue may be a better place for discussion) So what are we going to do for Could user code be written in a version-portable way by using |
I think we should just drop the User code cannot manipulate The only use of (I don't have any problem with packages reaching into the implementation of the runtime and poking its internals, but I don't think it's our job to support such uses as the runtime evolves) |
Alternatively one can rename the struct |
@kayceesrk, sure, but ocamlnet will not have to just use |
It is a bit annoying that runtime system development has to take into account undocumented APIs. The manual does not mention |
Would the following patch make sense to fix the base issue? diff --git a/lib/base/src/exn_stubs.c b/lib/base/src/exn_stubs.c
--- 2b950f22b3b6/lib/base/src/exn_stubs.c 2019-12-05 12:38:07.257682751 +0000
+++ working-dir/lib/base/src/exn_stubs.c 2019-12-05 11:57:04.288006823 +0000
@@ -1,8 +1,19 @@
#include <caml/mlvalues.h>
+#if OCAML_VERSION >= 41000
+
+CAMLprim value Base_clear_caml_backtrace_pos () {
+ Caml_state_field(backtrace_pos) = 0;
+ return Val_unit;
+}
+
+#else
+
extern int caml_backtrace_pos;
CAMLprim value Base_clear_caml_backtrace_pos () {
caml_backtrace_pos = 0;
return Val_unit;
}
+
+#endif (Apparently, an |
I agree with @kayceesrk that we don't have to maintain compatibility for libraries that use |
I do not see what point this is trying to make: nobody here says the contrary, in fact we already said the same on a PR by Jacques-Henri recently. When I split this issue from the original PR, I did not think that two months later we would be there discussing straw-man arguments. My point was that somebody for some reason has decided that The allusion to other breaking changes coming with multicore is off-topic, but I'll bite: the criteria of APIs being documented or not is not the good one. Indeed, OCaml is rarely documented down to the fine details that matters for some real world programs, and it will not always be as obvious as the current issue. Of the various ideas of breaking change I have heard floating around (I made a list!), there are enough to increment OCaml's major version several times over. One of them is radical enough to result in a split of the language. It was decided that multicore developers would have some leeway for introducing breaking changes, nothing is secret when you get a chance to chat with them, one can find open discussions on the multicore github, but currently there is a lack of visibility. I have more to offer than negative comments on the topic, but currently we miss a place where this can be discussed that lists which changes are seriously being considered and explains the migration strategy. The new RFC repo for instance would be a good place to start a discussion like this, and I warmly encourage it. |
Closing: #9115 has been merged. |
I believe that if you want to minimise code duplication, you can also simply do: +#if OCAML_VERSION < 41000
extern int caml_backtrace_pos;
+#endif Indeed, What you propose makes sense to me as well. |
Indeed, we will quite probably end up with something as simple |
(Indeed, it has just landed with #9115.) |
caml/compatiblity.h
is not up-to-date for a backwards-compatible experience.From #8940 :
The text was updated successfully, but these errors were encountered: