Does Scala even need the `try` keyword, and must `catch` be a keyword? I'd be happy to call `.catch(partialFunction)` directly on an expression or code block. It could be implemented as an extension method.
-
-
Replying to @propensive
If it's possible to implement as efficiently as normal try/catch, and to opt-out (so that `catch` can be provided as an extension in e.g. MonadError, which would be nice), then sure
1 reply 0 retweets 0 likes -
Replying to @kubukoz
Scala 3 could inline it, but Scala 2 would need an additional allocation and stack frame (or two...).
1 reply 0 retweets 0 likes -
-
Replying to @kubukoz @propensive
But we can't change it in Scala 2 anyway.
1 reply 0 retweets 0 likes
Replying to @kubukoz
I'm sure you could make a 1-bit change to the Scala 2 parser and you could start using `catch` as a method name...
3:30 PM - 6 Mar 2020
0 replies
0 retweets
0 likes
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.
