4 ms·
do you think it's worth fixing deeper stuff, like arrays of numbers being lexically sorted?
by exit 16y ago
do you think it's worth fixing deeper stuff, like arrays of numbers being lexically sorted?
- jashkenas 16y agoThere are lots of things that it would be wonderful to fix, but can't be done without either patching native objects, running an interpreter on top of JS, or adding lots of special functions in a required library. Take, for example, negative array indices. It would be lovely if JS allowed you to say: array[-1] As an alias for array[array.length - 1] Unfortunately, we can't add the feature because you'd have to intercept "[]" at every call site. For example: a[b] Is a an array or an object? Is b a string or a number, and if so, is it negative? You just don't know at compile time, so we don't support the feature. This is just one example of something that would be nice to fix about JS, but can't be done cleanly -- there are plenty of others.
- exit 16y agofair enough. i suppose ultimately the browser just needs a neutral vm.