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.
And then once we moved to 1JS, it just seemed that much worse to have the
variability, since the exact same code can have different meanings right near
each other:
var x = typeof null;
module Foo {
export var y = typeof null;
}
console.log(x) // "object"
console.log(Foo.y) // "null"
It's just not worth it.
OTOH, we could pretty easily add a new library function:
import type from "@std";
console.log(type(null)) // "null"
I'd support that.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss