If you unbox the Option then you don't have an Option any longer and can't really blame Option for what happens next. Option gives you the same choices plus can be used in for-comprehensions like any other monad. On Jun 5, 2012 12:29 PM, "Cédric Beust ♔" <[email protected]> wrote:
> On Tue, Jun 5, 2012 at 8:13 AM, Ricky Clarkson > <[email protected]>wrote: > >> There is value in being *able* to go from null to null (or nil to nil or >> None to None). The problem is when it's unintentional and that's what >> we're saying is bad in JQuery and Objective-C, that there's no visual cue >> that you might be operating on a nil. >> > > Absolutely. There are times where I want to be able to write a.foo.bar.baz > without inserting null checks at every step along the way (and please spare > me the Demeter nonsense :-)) and times when each of these should always > return something, so a null return should blow up right away. > > Like we discussed, @Nullable and @Nonnull do exactly that. Groovy and > Kotlin offer similar flexibility (Kotlin with sure()). > > Option is actually the one that gives you the least choices because if you > decide to unbox the option to enable the "fail fast" mode, you find > yourself in the mixed world of Option/Raw values with all the drawbacks I > described. > > -- > Cédric > > -- > You received this message because you are subscribed to the Google Groups > "Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
