Nulls

Tim Peierls tim at peierls.net
Sun Sep 23 07:33:25 PDT 2012


On Sun, Sep 23, 2012 at 10:11 AM, Doug Lea <dl at cs.oswego.edu> wrote:

> So unobvious that I still don't see it. As long as you aren't treating
>>> null as
>>> an acceptable value in Streams or as the contents of an Optional, why do
>>> you
>>> need to re-check?
>>>
>>
> But in Brian's proposal, null IS acceptable.


It's tolerated, but what we're talking about -- are we not? -- is the
extent to which this toleration distorts the overall design.

So when I said "Doesn't bother me", I meant that the implications you point
out for null-obliviousness -- e.g., findAny "lying"; repeating Map.get
anti-pattern -- aren't important enough to me to warrant abandoning the
proposed rules:

>
>    - Streams are completely null-oblivious (we don't treat them specially
>    at all)
>
>
>    - Option is null-hostile.
>
> Yes, there's a risk that people won't get the "don't use nulls in your
collections" memo, but as you point out by bringing up Map.get, it's
something that folks have been dealing with for years. At least the ones
who do get the memo won't be punished for the potential sins of those who
don't.

--tim


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