by ryanong · 8y ago · 0 comments
I run into this all the time. Plenty of junior devs I work with do this. Unfortunately we haven't implemented typescript yet. Yea === solves this problem but I wish there was a deprecation path for ==. Why can't we figure out as a community how to deprecate horrible javascript apis? Why can't we as a community figure out how to have a good standard library?
IMO TypeScript fits like a glove on top of JS and largely gets rid of the language problems, leaving mainly library / ecosystem problems.
Dart did many things wrong, but one thing it did do right was the standard library. If we had a standard library like that in JS, that would change everything.
Another serious problem are modules. The fact that the ES6 loader is "open ended" just means that we don't really have a solution to the problem of distributing JS. The fact that HTTP2 push is somewhat broken means we can't rely on it to load ES6 modules either.
At the very least we need the concept of absolute and relative module identifiers. Even if the specifics are implementation-defined, e.g.
* whether module ids are used,
* or content hashes,
* or absolute paths (or maybe npm module names with the version?)
the ability to provide absolute modules via a DLL:
provides 'lodash@2.0.5' {
export ... // multiple things
}
provides 'other-module@version' {
}
would be of incredible help.That, or maybe we can fix HTTP2 push.
I mean, JS definitely has serious problems, but equality coercion is not one of them :)