Tab Atkins Jr. wrote:
On Thu, Jun 14, 2012 at 11:01 AM, Brendan Eich<[email protected]>  wrote:
We have a problem with || indeed. The question is whether the solution
should equate null and undefined. CoffeeScript chose the
conceal-the-difference path and it has users. The users who want null to be
distinct from undefined are neither CoffeeScript users, nor || users (in
their defaulting code). They must be doing === undefined test. That is rare
too (not quite as rare as passing null instead of undefined as intentional
default trigger in my experience).

What is your reason for preferring === undefined over == null, since we have
a dilemma and users often use an even looser (falsy, viz ||) test than ==
null, but some use == null and others use === undefined, for the defaulting
trigger?

I don't claim to be typical in cases like this, but my experience is
similar to Herby's - I use || most of the time just because it's short
and easy, but switch to "x === undefined" with a trinary if x might be
falsey.
Yeah, I switch, too. If I see it is needed, and don't forget it. That is why || is uneasy, ?? would remove the fear (in Kent-and-Ward TDD sense).
~TJ
Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to