Is there some caveat I need to know if I sometimes `open Core` and sometimes don't?

Writing a small website using Ocsigen, in most of the modules, I open Core, but I cannot do that in the two modules that uses pgocaml.syntax (if I do that, the compiler would complain something about labeled application, guess the code generated by PGOCaml isn’t core-friendly).

The application compiles ok and as far as I can see, runs ok, but I’m a little worried, since I pass values between those who open Core and those don’t (but I do use Core.blah in those who don’t), will this leads to some runtime crash that otherwise can be caught at compilation time?

I think you are confusing things a bit. open Core means “get me all the names that would be accessible with Core.* and make them accessible directly without the Core. prefix”. The reason why it conflicts with pgocaml is probably because Core.* names different signatures than the names that they might be replacing, so that’s why the “labeled application” error.

And no, it will most likely not lead to runtime crashes, unless the non-Core values you pass are handled by the Core functions differently. But I would say that is a very unlikely scenario. But you should be careful what types you pass where, that should be deliberate and not “it accidentally compiled”.

1 Like

Thanks for the clarification, it helps.