4 ms·
While I agree in theory, boxing a null like that can have severe garbage collection implications. If every core function that required a simple two or three sta
by paupino_masano 14y ago
While I agree in theory, boxing a null like that can have severe garbage collection implications. If every core function that required a simple two or three state response returned a boxed object then it also adds a requirement for the GC to "throw away" the object when necessary. The more trash the GC needs to clean up = the more time the GC uses cleaning up.
I'd be careful - that's all. I've seen systems which have done exactly this for core pieces of logic and they have suffered miserably during long running processes.
Mind you I'm referring to Java/.NET here - I'm not familiar with Scala's subsystem so can't comment on that...
- fusiongyro 14y agoThe idea here isn't to replace every T with Option[T]. The idea is to locate the places where incoming data might be absent and handle it there, so that the other 90% of your code can just use T with wild abandon. Like most methodologies, if you do it wrong it will be a fiasco and if you do it right it won't be so bad.