douglas at crockford.com
Tue May 8 20:10:09 PDT 2012
On 5/8/2012 2:45 PM, David Herman wrote:
> On May 8, 2012, at 9:19 AM, Rick Waldron wrote:
>> non-strict, non-opt-in:
>> typeof null === "null"; // false
>> implied opt-in:
> Changing typeof null always seemed questionable to me in terms of value.
> It doesn't really give you significant new functionality, it just kinda
> seems "more sensible". But adding it would just make things *more*
> messy, for very little gain. Since we can't eliminate the old typeof
> semantics, we end up with the language having different semantics in
> different contexts.
The issue isn't typeof null. null === is a more convenient test. The
issue is that typeof object gives a false positive when the value is
null. So sensing that a value is an object is error prone. We need a
simple, reliable test for objectness.
More information about the es-discuss