Loose ends: Optional

Brian Goetz brian.goetz at oracle.com
Sun Jun 2 18:02:27 PDT 2013

> Is Optional crippled if we consider that it's just an object that represent a value or no value ?
> I don't think so.

Of the people that have an opinion on this subject, you would be in a very, very, very, very, very small minority.  I have received over a hundred e-mails and tweets on the subject where people are essentially saying "optional is crippled without these" -- and none expressing the opposite opinion.  I realize this is vastly unscientific, and it represents a vanishingly small and self-selected portion of the Java developer base, but of the people who care, it is basically lots of people saying "we need this" vs a few saying "but if I give it to you, others will misuse it."  

>> It is something we want to avoid -- I will certainly avoid it in my code, and criticize any code I see using this (or any of ten million other bad programming techniques.)  The world is full of useful tools that that interact dangerously, such as bleach and ammonia or toasters and bathtubs.
> Wrong example, I don't know in US but in France you can not have a power outlet too close to a bathlub :)
> That's exactly what we are talking about.

And extension cords are illegal in France too?  :)

> But you can don't add these 3 methods because they send the wrong message.

I get what you're saying about what message it sends, and that's a reasonable thing to worry about.  On the other hand, making toasters illegal because we already have bathtubs and extension cords is also worrisome.  

I would like to hear from other members of the EG on this. 

More information about the lambda-libs-spec-experts mailing list