4 ms·
But is it really? Maybe I'm missing the point but it is a nice way to express that a function may or may not calculate something, no? At least it seems way bett
by stinos 11y ago
But is it really? Maybe I'm missing the point but it is a nice way to express that a function may or may not calculate something, no? At least it seems way better than returning bare pointers or pasing an argument by reference+returning bool, or returning a unique_ptr, or ...
- toolslive 11y agoIf you come from ML or Haskell and start using boost or Java's option, you actually feel ripped off. Some people claim it's a sort of documentation denoting 'intent', but I don't want documentation. I don't want options to infect the whole codebase, I just want to pattern match once and extract the value, and never have to check again for None or null. The problem in Java is the type system has references. X static use_it(X x){ ....} really has a signature something like this: use_it : X ref -> X ref no little library is going to fix that.