Non-extensibility of Typed Arrays
Mark S. Miller
erights at google.com
Tue Aug 27 10:00:05 PDT 2013
On Tue, Aug 27, 2013 at 9:35 AM, Oliver Hunt <oliver at apple.com> wrote:
> Existing types with magic index properties (other than Array) just drop
> numeric expandos on the floor so it's logically a no-op.
Dropping assignments silently is a bug, as it allows code to innocently
proceed on control flow paths that assume success. That's why strict-mode
turned failed assignments into thrown errors.
> Unless there was a numeric accessor on the prototype (which
> non-extensibility does not save you from).
> My complaint is that this appears to be removing functionality that has
> been present in the majority of shipping TA implementations, assuming from
> LH's comment that Chakra supports expandos.
"majority" is not a relevant constraint. We should try to make the best
decision we can that is compatible with the cross browser web. If all the
major browsers already agreed on one behavior, then we should only consider
deviating from it with great caution. But so long as the major browsers
differ, we need only feel constrained by compatibility with their
intersection. This principle even overrides compatibility with previous
versions of our own spec, as just discussed re [[Invoke]].
> On Aug 27, 2013, at 9:26 AM, Domenic Denicola <domenic at domenicdenicola.com>
> > I am not aware of all the nuances of the discussion, but as a developer
> I would find the behavior for numeric expandos confusing. For a typed array
> of length 1024, setting `ta` would do something completely different
> from setting `ta`. Unlike normal arrays, setting `ta` would not
> change `ta.length`, and presumably `ta` would not be exposed by the
> various iteration facilities.
> > I would much rather received a loud error (in strict mode), which will
> either alert me to my code being weird, or possibly to my code committing
> an off-by-one error.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss