Introducing a Result<ok, err>
type
#275
rvcas
started this conversation in
Core language features
Replies: 1 comment
-
Considering now(bls and conversion to string excluded) builtin errors are now caught and a traced error is thrown. I wonder how possible this might be? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The idea
We've been talking about introducing a new type defined as:
and also:
Mostly for convenience to people coming from other functional languages.
From there we can perhaps do a few extra things.
Maybe validators now return
Result<Void, Error>
Example
I'm not particularly in favor of this because having APIs based on Result can be a slippery slope for increasing the compiler scope.
We can imagine there will be many
Error
types defined across many libraries. We can also imagine like in rust many times you'll want to just unwrap theOk
and letErr
bubble up.Issues
The above would be a type mismatch.
My suggestion
Beta Was this translation helpful? Give feedback.
All reactions