Skip to content
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

Should [SameObject] be allowed with FrozenArray<T>? #1402

Open
rakuco opened this issue Apr 26, 2024 · 5 comments
Open

Should [SameObject] be allowed with FrozenArray<T>? #1402

rakuco opened this issue Apr 26, 2024 · 5 comments

Comments

@rakuco
Copy link
Member

rakuco commented Apr 26, 2024

What is the issue with the Web IDL Standard?

The spec currently allows [SameObject] to be used with interface types and object. In w3c/compute-pressure#269 we were wondering if the restriction on FrozenArray<T> makes sense or not.

@kenchris
Copy link

When we worked on Orientation Sensor, the idea was exactly that we would get the same object for all calls, and I believe we had to move it to use the FrozenArray for that reason.

@domenic
Copy link
Member

domenic commented Apr 30, 2024

[SameObject] is just documentation in the current Web IDL spec so it doesn't really matter. You have to make sure you write your getter steps correctly to specify the actual desired behavior.

@foolip
Copy link
Member

foolip commented Apr 30, 2024

I think the problem is that FrozenArray isn't an interface and not the same as object, so a Web IDL validator would complain about it.

@annevk
Copy link
Member

annevk commented Apr 30, 2024

Right, we need to replace [SameObject]: #212.

I'd also double check you really want FrozenArray. It uses rather dubious ES5 semantics and not as much is frozen as the name might lead you to believe. Generally I'd try to design APIs differently as to not require that.

@rakuco
Copy link
Member Author

rakuco commented Apr 30, 2024

I'd also double check you really want FrozenArray. It uses rather dubious ES5 semantics and not as much is frozen as the name might lead you to believe. Generally I'd try to design APIs differently as to not require that.

My uninformed guess is that at least some of the specs use it as a way to make an attribute return some sort of array, as sequence<T> cannot be used as an attribute type. Do you mean reworking APIs so that they don't return make attribute getters return sequences or using a different type to represent the same thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants