-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is unclear if [AllowShared] BufferSource is valid #961
Comments
There is some discussion in #827. |
My current thinking on this:
The outcome of that might well be that [AllowShared] BufferSource is valid as [AllowShared] would end up ignored for ArrayBuffer. I don't have strong feelings about that. |
+1 for Anne's proposal. Only a nitpick I see is that, considering ArrayBuffer vs SharedArrayBuffer, BufferSource vs SharedBufferSource could be a little confusing. IIUC, the proposal is:
Considering ArrayBuffer vs SharedArrayBuffer, the proposed SharedBufferSource does not correspond to SharedArrayBuffer. It corresponds to (ArrayBuffer or SharedArrayBuffer). "Shared" prefix looks confusing to me. |
That makes sense, I guess for clarity typedef (SharedArrayBuffer or [AllowShared] BufferSource) AllowSharedBufferSource; I think that works because typedef (ArrayBuffer or SharedArrayBuffer or [AllowShared] ArrayBufferView) AllowSharedBufferSource; |
What makes that ignored? That behavior does make sense to me, but I don’t think it’s what’s currently specified. Type-applicable EAs get distributed to union members unilaterally right now, they aren’t filtered by whether a member does or doesn’t permit that annotation, so I think it would presently imply an error. |
You're right, #827 still exists. |
Generally IDL objects have been 1:1 with ECMAScript objects, except for SharedArrayBuffer. That was instead represented as [AllowShared] ArrayBuffer, although that includes ArrayBuffer as well. This created a number of challenges, e.g., how to return a SharedArrayBuffer object. So we make these changes here that will also require corresponding downstream fixes: * SharedArrayBuffer is now its own type. * [AllowShared] only applies to buffer view types. * AllowSharedBufferSource takes over from [AllowShared] BufferSource. Fixes #865 and fixes #961.
Generally IDL objects have been 1:1 with ECMAScript objects, except for SharedArrayBuffer. That was instead represented as [AllowShared] ArrayBuffer, although that includes ArrayBuffer as well. This created a number of challenges, e.g., how to return a SharedArrayBuffer object. So we make these changes here that will also require corresponding downstream fixes: * SharedArrayBuffer is now its own type. * [AllowShared] only applies to buffer view types. * AllowSharedBufferSource takes over from [AllowShared] BufferSource. Downstream is tracked by #1320. Fixes #865 and fixes #961.
The spec says
"A type that is not a buffer source type must not be associated with the [AllowShared] extended attribute."
and
"The buffer source types are ArrayBuffer, DataView, and the typed array types."
BufferSource is a union type
typedef (ArrayBufferView or ArrayBuffer) BufferSource;
Yet https://heycam.github.io/webidl/#AllowShared has an example using [AllowShared] BufferSource.
The text was updated successfully, but these errors were encountered: