-
Notifications
You must be signed in to change notification settings - Fork 52
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
Kotlin result #728
Kotlin result #728
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(a) can we get rid of Res?
(b) Can we replace the .ok/.err methods that seem to be globally added (?) with local free functions?
Yes and done.
I'm not sure I understand. We can move them to always be local to the class, but I don't understand the benefit as it would just duplicate the code accross classes. Could you elaborate on the reasoning? In any case it should be a small change. I've made them internal now, so they shouldn't escape the library. As for free functions, I'm not familiary with the term. A quick googling tells me it's like a function which doesn't take a "self" param in Rust's terminology. However, a lot of the code flow assumes that the |
No I just meant package local.
I was thinking of a free function as in the equivalent of a standalone But this is fine too!! |
cc @emarteca |
Thanks for doing this! I just made a PR making the struct and opaque error results Other types are hard to return so that Kotlin can actually use them, since we can't make them |
Uses kotlin result. An attempt to address #697. I have to admit I'm not a big fan. On the plus side it is more ergonomic, but a big minus is we completely erase the type of the error. Unfortunately as per the discussion in the issue we can't make a generic wrapping class. Instead we would have to change the error type to extend Throwable. Let me know what y'all think of this.