archives

« Bugzilla Issues Index

#4103 — %TypedArray%.prototype.set should have a clear algorithm to invoke its two possible sub-algorithms


The prose around the non-typed-array method suggests that it's to be called when a non-typed-array is passed as |target|. Internally, that argument is passed to |ToObject| and its result ReturnIfAbrupt'd. This is inconsistent. I would much prefer if there were a fundamental %TypedArray%.prototype.set algorithm, that invoked one or the other more-specific algorithm as desired, rather than make inconsistent claims about how the two algorithms are supposed to be used and/or work.

This would also permit moving the common code between the two algorithms -- steps 1-10, approximately -- into that overarching algorithm.


see Bug 4102
/target/ is the this value, not the argument.

I've also clarified the assert in step 1 a bit.

Using this style of multiple algorithm for over-loaded methods is something that has some history in the ES spec. It's probably debatable whether it is better or worse than an simple method spec. that combines all the over-loads.

I'm not going to do any more restructuring of that sort in the ES6 spec. so I'm marking this as deferred to ES7 so it can be considered in that context.