New ES6 strawman: Array.prototype.fill and Array.prototype.move

Brendan Eich brendan at mozilla.com
Sun Jun 23 13:16:11 PDT 2013


Axel Rauschmayer wrote:
>>> Array.prototype.move = function move(target=0,source=0, 
>>> count=this.length-source)
>>> Is the case of moving trailing elements somewhere else very common? 
>>> If not, then I’d define the parameters in this order: source, count, 
>>> target.
>>> Rationale: easier to memorize.
>>
>> No, assignment-expression LHS/RHS (target/source) order precedent 
>> wins for memorization (see Object.extend precedent, strcpy, memcpy, 
>> etc.).
>
> That makes sense, thanks!
>
> I was thinking System.arraycopy, which may not a good precedent:
> http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#arraycopy%28java.lang.Object,%20int,%20java.lang.Object,%20int,%20int%29

You lost me at "oracle.com/java..." :-P.

/be

>
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de <mailto:axel at rauschma.de>
>
> home: rauschma.de <http://rauschma.de>
> twitter: twitter.com/rauschma <http://twitter.com/rauschma>
> blog: 2ality.com <http://2ality.com>
>


More information about the es-discuss mailing list