Why do we care or not care what’s inside in each case?
-
-
The person looking at a function does not care what it does inside, they only care that it returns a result. "catches" is the exact opposite of what the function does from this perspective. When writing a catch block you actually do care that it catches the result inside it.
2 replies 0 retweets 0 likes -
This is equivocation between the person writing the catch block and the person reading the catch function’s signature, inverted roles 1/2
1 reply 0 retweets 0 likes -
Replying to @withoutboats @ManishEarth and
I *do* care that this function catches an error anyway: I need to handle it or throw it before I can get to that sweet -> T type I actually want
2 replies 0 retweets 0 likes -
Replying to @withoutboats @ManishEarth and
In contrast, when a function throws I get my -> T with no work, I have the option to catch the error or just let it keep throwing
1 reply 0 retweets 0 likes -
Replying to @withoutboats @ManishEarth and
Using catch instead of throw emphasizes the core distinction between this proposal and exception based systems
2 replies 0 retweets 0 likes -
That's a point against throws, not a point for catches. How about "T errors E"? A more neutral term imo.
1 reply 0 retweets 1 like -
Replying to @ManishEarth @withoutboats and
how is this more ergonomic? We’re like 2 characters away from writing Result? (The comma, and a GT/LT) otherwise character count is identical. One just muddies the water that your getting a sumtype return value making is implicit.
1 reply 0 retweets 1 like -
Replying to @valarauca1 @ManishEarth and
Sorry to clap at you but
ergonomics
is
not
about
character
count3 replies 0 retweets 1 like -
Replying to @withoutboats @ManishEarth and
yours is a good point. I shouldn’t have focused on character count. I just don’t like Result being obsfucated.
1 reply 0 retweets 1 like
We already have precedent for obfuscating a type, `-> ()`, fwiw.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.