||= is much needed?

David Herman dherman at mozilla.com
Sun Jun 17 07:17:42 PDT 2012

On Jun 15, 2012, at 5:57 PM, satyr wrote:

> On Sat, Jun 16, 2012 at 4:33 AM, David Herman <dherman at mozilla.com> wrote:
> As for null, I can see how there's confusion about whether to use null vs undefined, and so I can see why CoffeeScript would just try to blur the distinction between them.
> Not just for blurring. Rejecting `null` is essential for CoffeeScript's "existence" due to `?.`, the soak/safe access operator.

I think you could make a case for ?. defaulting for both but ?? defaulting only undefined. The case goes something like this:

- The purpose of ?? is to provide a default value when no value was provided. The way to say "no value" in JavaScript is undefined.

- The purpose of ?. is to fail soft when doing a property lookup. Both null and undefined throw when doing a property lookup.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120617/3bab52cd/attachment.html>

More information about the es-discuss mailing list