6 ms·
What I don't like is lack of features that would erase whole classes of software around it. For example, function environments (substitute the global scope with
by wruza 1y ago
What I don't like is lack of features that would erase whole classes of software around it. For example, function environments (substitute the global scope with another object for a single invocation) could delete lots of code and paradigm from vue/rx-likes.
It also neither supports operator overloads (good thing in general) nor has a decimal type which is a must for human numbers like euros and kilograms. Rather it includes the mostly useless bigint.
It also does nothing to fix the mentioned quirks like sort(). It could e.g. include cmp(a, b), and propcmp(name[,cmp]) off the shelf so the issue wasn't wordy at least: nums.sort(cmp), objs.sort(propcmp("id")).
- queenkjuul 1y agoCan't you `function.bind(context, ...)` or am i misunderstanding
- wruza 1y agoBind substitutes `this`, not global scope. With function envs you can write functions like function () {a += 1} and have it increment `a` in some object.
- hajile 1y agoThere is a decimal proposal for JS. It almost certainly won't use normal operators though because of the JIT implementor complaints about adding BigInt (not to mention recently dropping the record/tuple proposal over `===`). https://github.com/tc39/proposal-decimal https://github.com/tc39/proposal-decimal
- wruza 1y agoThen it's of little use imo. Library decimals already exist in multiple optimized forms.
- hajile 1y agoIt would still use faster JIT mechanisms internally and make strong guarantees, but the interface would suck. JS really needs to add a "use type" or typed module feature with strong Hindley-Milner types. This would allow them to cut the rest of the really bad parts like the bad type coercion, but definite types would also mean that adding these new features to typed modules only would get rid of the performance issues for stuff like operator overloading because the types would be known in advance.