-
Notifications
You must be signed in to change notification settings - Fork 164
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
FrozenArray: Is T mutable? #348
Comments
(I suppose |
Being able to freeze the arguments would help with whatwg/notifications#74 although it's all a little hacky. I'm still not a big fan of the FrozenArray pattern. |
Another confusion: If the values of FrozenArray<T> have values that are references ("unlike sequence types, which are lists of values that are passed by value"), does FrozenArray<DictionaryType> make sense? Can dictionaries be passed by reference? I'm trying to implement a spec that has a FrozenArray<DictionaryType> attribute: https://w3c.github.io/webrtc-pc/#dom-rtccertificate-fingerprints |
"Dictionaries are always passed by value. ... any dictionary returned from a platform object will be a copy and modifications made to it will not be visible to the platform object." https://www.w3.org/TR/WebIDL-1/#idl-dictionaries Well, FrozenArray<DictionaryType> is still handy to have (and used in several places in the webrtc spec), the implementation just has to make sure that the elements are copied. |
The quoted bit is saying the When it says "unmodifiable values" what it means is IDL values, in the sense of "things that have an IDL type". These could be references or value types, depending on T. This might be worth making clearer somehow...
Yes, exactly, just like it would for |
A FrozenArray<T> is said to be:
http://heycam.github.io/webidl/#idl-frozen-array
A fixed length value of unmodifiable values sounds like the values themselves are immutable. But the values are references, and the conversion from sequence does not freeze the elements of the array, only the array object:
http://heycam.github.io/webidl/#es-frozen-array
It is clear that
frozenArray.push(foo)
andfrozenArray[0] = 42
should have no effect, but what aboutfrozenArrayOfObjects[0].foo = "bar"
?We should either:
SetIntegrityLevel(array[i], "frozen")
.The text was updated successfully, but these errors were encountered: