kaizhu256 at gmail.com
Sat Nov 25 06:09:52 UTC 2017
On 10/28/17, Frederick Stark <coagmano at gmail.com> wrote:
> I'd just like to thank TC39 for not breaking compatibility. All the niche
> old libraries I use that were written in ES5 still work in my ES6+ projects
> with no issues.
introducing the new typeof Symbol() === 'symbol' does break backwards
compatibility with many es5 libraries that default to 'object' type if
typeof is not 'boolean', 'number', 'string', 'function', or
fortunately symbols are not used by everyday programmers (and rightly
so), so its rarely encountered by these libraries. if tc39 did really
care about backwards-compat, they should've treated it as an 'object'
type with a Symbol.isSymbol subtype-check like Array.isArray.
this brings up another backwards-compat issue - what's the typeof for
proposed BigInt / Int64 / Decimal? i prefer treating them as 'number'
or 'object' with subtype-checks BigInt.isBigInt et al., but Symbol has
dangerously broken that precedent. in general my opinion is tc39
should freeze the existing set of typeofs (and use subtype-checks) for
sake of backwards-compat and library/tooling stability.
More information about the es-discuss