Post 3086933 by cks@mastodon.social
(DIR) More posts by cks@mastodon.social
(DIR) Post #3081740 by ceejbot@rafting.io
2019-01-17T22:46:50Z
0 likes, 0 repeats
"Explicit error handling with error values and multiple return"I have reached a point where I prefer this to exceptions. [cue argument]
(DIR) Post #3081818 by mkb@mastodon.social
2019-01-17T22:49:22Z
0 likes, 0 repeats
@ceejbot Sorry I don’t have my arguing boots on today. Still, I’m curious about your reasoning. Care to elaborate?
(DIR) Post #3082208 by meqif@octodon.social
2019-01-17T23:00:40Z
0 likes, 0 repeats
@ceejbot Rust did spoil me in that regard with the Result monad. :rust_ferris_happy: It sure beats (unchecked) exceptions when attempting to create a mental model of what can go wrong with a piece of code!
(DIR) Post #3082245 by ceejbot@rafting.io
2019-01-17T23:01:31Z
0 likes, 0 repeats
@meqif I love the Result monad!
(DIR) Post #3082306 by ceejbot@rafting.io
2019-01-17T23:03:47Z
0 likes, 0 repeats
@mkb Explicit over implicit; clear responsibility for handling the error; easier to think about what happens in error cases (it's right there).An example: every JS project I've worked on has somewhere in it a wrapper around JSON.parse() to catch the exception & return some agreed-upon value instead. (Mult return values would be nicer here.)
(DIR) Post #3086933 by cks@mastodon.social
2019-01-18T02:25:06Z
0 likes, 0 repeats
@ceejbot I like explicit error handling except for the bit where error handling is all over my code and sometimes I forget or am tempted to say 'this can't possibly fail and if it does there's nothing I can do'. I hear Rust has good ergonomics for that, though, so maybe more languages will have them too someday.