mmottl / gsl-ocaml

OCaml bindings to the GSL (GNU Scientific Library).
Other
36 stars 10 forks source link

Initialize the error handler #25

Closed Chris00 closed 6 years ago

Chris00 commented 6 years ago

I believe — I have not checked completely — that with modules aliases if one uses a Gsl.X module but not Gls.Error, then the error handler is not initialized. I guess the initialization should be performed in the Gsl module itself.

mmottl commented 6 years ago

It seems a solution is not quite so straightforward. We'd essentially have to make sure from within each Gsl submodule that Gsl.Error is referenced in a way that triggers initialization (ideally by just calling initialization explicitly). Even if we put a let () = ... block in Gsl, it would not be called unless the user referred to some value within Gsl directly. This excludes module aliases.

Do you know of any other solution that is guaranteed to trigger initialization code? If not, I'll have to add a call to each module. This is somewhat error-prone, because people adding new modules will have to make sure to do so, too.

Chris00 commented 6 years ago

Do you know of any other solution that is guaranteed to trigger initialization code?

I'm afraid I don't.

mmottl commented 6 years ago

I feared so. Oh well, it wasn't too much work. I have pushed the changes and will make a new release right away.