Brendan Eich (2013-07-17T19:05:44.000Z)
domenic at domenicdenicola.com (2013-07-24T00:10:45.900Z)
Domenic Denicola wrote: > From: Brendan Eich [brendan at mozilla.com] > >> You still value the >> >> ```js >> (x == y&& typeof x == y)<=> x === y >> ``` >> >> invariant, right? That's the motivation for decimal, int64, etc. having their constructor-named "decimal", "int64", etc., typeof-result strings. > > You have brought up this invariant in many threads. Yes, and I've written about why invariants matter on occasion -- perhaps you missed that :-P. https://mail.mozilla.org/pipermail/es-discuss/2008-September/007610.html --- > Postel's Law means you accept everything that flies in ES1, and have > trouble being less liberal in ES2+. Web authors crawl the feature > vector space and find all the edges, so at least what you did not > accept in v1 becomes law. But these are generalizations from > experience with invariants such as typeof x == "object"&& !x => x === null and typeof x == typeof y => (x == y<=> x === y). > Beyond this conservatism in breaking invariants based on experience, > it turns out that % and / results do flow into array indexes. From > SunSpider's 3d-raytrace.js.... --- > Could you explain its importance and value? My feeling is that nobody uses `==`, Your feeling is wrong. == is used (I miss Google codesearch) widely on the web. > so a relation tying together `==`, `typeof`, and `===` doesn't really impact anything people use. See above. Language designers value and conserve invariants based on long experience with painful counterexamples. > Put another way: why do you feel this is an important base invariant of the language, to be preserved, rather than just an equality that happens to fall out of what we have in the language now? It's not an equality, rather a two-way implication. It helps us reason about all three of typeof, ==, and === as we evolve JS. It's not noise, and not nothing. We could deliberately break it, but for what win?