by joegaudet · 12y ago · 0 comments
One problem, which is also one of the advantages of scala is that the interop with Java often means that all your Option[] etc code can still get NPEed by some offending Java Lib you've decided to use.
As the fidelity and ubiquity of pure scala libs improves this will hopefully go away to a some extend.
scala> Option(System.getProperty("kaboom"))
res1: Option[String] = None
then map, getOrElse or fold at will.
(edited format)
We've been running scala in production for 4 years, and had our share of NPEs in our code and in the libraries we host. My point I guess was just that it's not entirely true that they will not boil to the surface on occasion.
Sometimes think I would love to have a layer between us and Java. Some sort of FFI which returned everything on an Option.
Probably too cumbersome, but still ...