You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes! It should probably expose some sort of immutable API, and also the current code raises exceptions because the C-code became more clear that way. The API should probably catch those and use something like Or_error instead.
I agree with the exception part and yes, raising from C is probably way easier than all the stuff that is required to return an error monad from C.
I wouldn't pull in Or_error.t necessarily, instead opting for result with a polymorphic variant (result is a built-in type and while it does not have an corresponding utility module in the stdlib but every 3rd party stdlib like Containers, Batteries, Extlib, Base has a module to work with result). Then the jwt.ml would contain the OCaml C wrappers and would not be exposed to the caller, instead there would be a libjwt.ml with a high-level API.
I can look into this when I have time, unless you beat me to it 😄
I think there should be a nice public API which should make sure the user can't misuse the C API.
The text was updated successfully, but these errors were encountered: