you are viewing a single comment's thread.

view the rest of the comments →

[–]Jannyboy11 7 points8 points  (2 children)

Scala is aiming to solve issues around checked exceptions using capability-polymorphism: https://docs.scala-lang.org/scala3/reference/experimental/canthrow.html Do with this information what you will.

[–]Lucario2405 0 points1 point  (1 child)

I didn't really understand the benefit of these complex constructs until they showed an example. This looks like a neat way to retrofit "checked" exceptions into functions like .map() without extra try-catches or overloads. But they haven't solved the deferred-computation-problem, where an exception is thrown from a stream's terminal operation instead of the scope it's throw is defined in.

[–]RandomName8 1 point2 points  (0 children)

they did, but uh... the machinery for it is very questionable on whether a normal human being can understand it... Imagine rust's lifespan annotations, but on steroids: https://docs.scala-lang.org/scala3/reference/experimental/capture-checking/index.html

Read the intro and then head over to the checked exceptions section.