What are the use cases for Scala 2.9's try…catch generalization?

前端 未结 2 1596
抹茶落季
抹茶落季 2021-02-07 03:47

I\'ve read about and experimented with the Scala 2.9 try...catch feature, and it has me thinking about possibilities. What would I actually use it for other than saving a couple

2条回答
  •  北海茫月
    2021-02-07 04:18

    Good answer by axel22, but I think the real reason for its introduction is something else. The try/catch/finally handling introduced a special case. You used a partial function literal, but you could not actually replace that with a partial function. Now, catch just receive a partial function, and one more special case in the language is gone.

提交回复
热议问题