Brendan Eich wrote:
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.
Joking aside, the weaker (source, target) order-precedent is from
bcopy(3) in BSD Unix. I don't know for sure, and the signatures differ
in other ways, but bcopy may have influenced Java's System.arraycopy design.
/be
/be
--
Dr. Axel Rauschmayer
a...@rauschma.de <mailto:a...@rauschma.de>
home: rauschma.de <http://rauschma.de>
twitter: twitter.com/rauschma <http://twitter.com/rauschma>
blog: 2ality.com <http://2ality.com>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss