3 ms·
> What I am yet to find in any programming language is a reliable way to put my cursor somewhere in the code base, and know exactly all the possible errors whic
by threeseed 2y ago
> What I am yet to find in any programming language is a reliable way to put my cursor somewhere in the code base, and know exactly all the possible errors which can happen, where they could come from, and whether I've handled them
You can do this in Scala with an IO type e.g ZIO.
All functions have a return type of IO[Success, Error] and it will always return one or the other.
- dingnuts 2y agoyeah but then you have to put up with the rest of Scala, and worse, the ecosystem
- tadfisher 2y agoThis is not a helpful comment.
- fire_lake 2y agoScala has exceptions so this is untrue no?
- hocuspocus 2y agoCats Effect and ZIO eventually catch unhandled exceptions but you are right, there's no way to know for sure, we're merely assuming that 1) Scala libraries have a sane behavior (i.e. no exceptions at all) 2) the developer is familiar with the Java libraries they're wrapping and will use IO.attempt pervasively. However, in the near future, the compiler itself should be able to handle all exceptions statically: - https://docs.scala-lang.org/scala3/reference/experimental/canthrow.html https://docs.scala-lang.org/scala3/reference/experimental/ca... - https://docs.scala-lang.org/scala3/reference/experimental/cc.html https://docs.scala-lang.org/scala3/reference/experimental/cc...