Give the man a prize. It looks like a specification bug! The a[0]=4 eventually leads to an assertion within the specification that fails. That means spec. bug. https://tc39.github.io/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver … Should fall through to OrdinarySet if p!==receiverhttps://twitter.com/bmeurer/status/1128674484217679873 …
-
-
Replying to @awbjs
Which assertion are you talking about? I probably missed it, but my impression was that it's intentional that the typedarray happily swallows the store?
1 reply 0 retweets 0 likes -
Replying to @bmeurer1 reply 0 retweets 1 like
-
Or, not but it should have if reciever instead of o was passed. [[Set]] should not be trying to mutate a prototype. Consider if length of prototype had been 1
1 reply 0 retweets 2 likes -
Replying to @awbjs
O in this case is the prototype. It's odd that it'd try to mutate the prototype, indeed. I don't think it's a bug in the spec, but just a weird consequence of the way [[Set]] is defined. I like your suggestion to do OrdinarySet if O!=Receiver
1 reply 0 retweets 0 likes -
Replying to @bmeurer
see https://github.com/tc39/ecma262/issues/1541 … It is a bug in the spec. I wrote [[Set]] spec for typed arrays and this behavior is not what I intended. [[Set]] should not be mutating prototypes. A user could write a Proxy that did that, but its behavior not be inconsistent w/ normal expectation
1 reply 0 retweets 1 like
For those following along, Allen has now filed the issue here:https://github.com/tc39/ecma262/issues/1541 …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
```
Object.setPrototypeOf(Array.prototype, new Int8Array(0));
const a = [];
a[0] = 4;
console.log(+a[0]);
```
Spoiler: browsers disagree on what's correct here.