Proposal: Elvis and Other Null-Safe Operators

Mark Mahieu markmahieu at googlemail.com
Sun Apr 5 10:19:52 PDT 2009


2009/4/5 Neal Gafter <neal at gafter.com>

> On Sun, Apr 5, 2009 at 4:40 AM, Mark Mahieu <markmahieu at googlemail.com>
> wrote:
> > Doesn't that mean that the compiler should reject the expression
> > 'list?.isEmpty()' ?
>
> Given the spec as written, yes.  However, it could be changed so that
> the result is the same as the result of the rewriting in the
> "compilation" section of the spec.  In that case its result would be
> Boolean.  However, that is likely to result in more runtime null
> errors, not fewer, if people do things like
>
> if (list?.isEmpty()) ...
>
> -Neal
>

Thanks, Neal.

I've started putting a rough implementation of this proposal together, just
to aid my own understanding.  Are you or Stephen (or anyone else) intending
to produce a prototype, or would it be useful if I polish up what I've been
doing?

Mark



More information about the coin-dev mailing list