Pros? Cons?
I recommend against. Given that Atomics is a low-level API for performance, the design spirit here should be easily compilable down to ISA-level atomic ops. Allowing Proxies wrapping SABs will mean JITs won't compile the Proxy case, which defeats the purpose of using Atomics in the first place.
If you wanted to permit Proxies of TypedArrays to be used in similar contexts, presumably you'd make several other changes to various places to access the internal slots of the underlying TypedArray. This would be a big change, and not quite in line with the general design of Proxies, which don't tend to get this sort of forwarding (Array.isArray being the one-off exception).
Right, as mentioned previously, proxies are not generally transparent, and should not be.
On Tue, Apr 24, 2018 at 12:34 PM, Domenic Denicola <[email protected]
wrote:
Right, as mentioned previously, proxies are not generally transparent, and
should not be.I don't know what you mean by "generally". Proxies used as membranes are
practically transparent but are not absolutely transparent. (I sometimes
use "cooperatively transparent".) We've been over this many times so I
don't want to rehash this, but please avoid statements that are so easily
misunderstood. Proxies were designed to enable membranes to be transparent.
We should generally not break practical transparency and have not.
Array.isArray is not an exception. It is necessary to uphold practical
transparency.
The damaging non-uniformity is that built-in functions from one realm are
able to see internal slots of objects from another realms. Even proxies
aside, this is annoyingly inconsistent with classes using private fields,
or even classes using WeakMaps to emulate private fields.
All that said, for the specific question asked here, I have to agree that
membranes should not be transparent wrt atomic operations on SABs. I
hesitate to introduce another exception to the general transparency of
proxies, but I think our hand is forced on this one.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tc39/ecma262/issues/1184#issuecomment-384053162, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAQtzDTKfFTGRGhk-goAKzN2UMgJ_6bFks5tr34ugaJpZM4Th9g1
.
--
Cheers,
--MarkM
Offtopic, but where can I read an explanation of how Proxies are generally transparent?
Thanks for the feedback. I came across this while writing Atomics tests for Test262, but I intentionally held back any context, to avoid tainting any responses. I suspect my use case isn't compelling enough to warrant further consideration.