W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2015

[Bug 29004] FrozenArray only provides shallow immutability

From: <nobody@w3.org>
Date: Fri, 31 Jul 2015 20:05:23 +0000
To: public-script-coord@w3.org
Message-ID: <bug-29004-3890-94H5rugPtK@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29004

--- Comment #9 from Jonas Sicking <jonas@sicking.cc> ---
One of the reasons that I want to return frozen Arrays from some APIs is that
that enables us to return the same object from multiple calls.

For example, it means that the HTMLInputElement.files can return the same
object every time that you get it. If the user attaches another file, we simply
create a new Array and return that.

If we don't freeze the Array, that would mean that custom properties set on
myInputElement.files will appear to "disappear" if a file is added.

Ideally we would use something like "value objects" rather than frozen Arrays,
however JS doesn't currently have those so that's not an option.


So I think frozen semantics is what we're actually looking for. Not just "can't
add or remove entries to the Array".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Friday, 31 July 2015 20:05:25 UTC

This archive was generated by hypermail 2.3.1 : Friday, 31 July 2015 20:05:26 UTC