Hacker News
new
past
comments
ask
show
jobs
points
by
gdotdesign
13 hours ago
|
comments
by
stefanka
12 hours ago
|
next
[-]
Have a look at the eros crate for rust. It implements a convenient error set mechanism mostly without macros
reply
by
Groxx
7 hours ago
|
parent
|
[-]
That looks almost exactly like what I've wanted from rust errors - thanks! Sadly I hadn't seen that before.
reply
by
Groxx
8 hours ago
|
prev
|
next
[-]
y = U64.from_str(b) ? InvalidSecond # returns Err(InvalidSecond(BadNumStr))
Ooo, I like that syntax. Implicit wrapping, but it gives you a type you control so you can <do stuff> if needed.
reply
by
rixed
5 hours ago
|
prev
|
next
[-]
Isn't that how exceptions work, as the union of all possible defined exceptions?
reply
by
gdotdesign
2 hours ago
|
parent
|
[-]
I differs that exceptions are hidden and you don't experience them until something happens so it's easier to forget to handle them (at least that is my experience). Here they are up front and visible and forces us to either handle or propagate them.
reply
by
guenthert
9 hours ago
|
prev
|
[-]
No recovery / restarts though.
reply