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

Brendan Eich brendan at mozilla.com
Sun Jun 23 13:36:03 PDT 2013


Allen Wirfs-Brock wrote:
> See 
> http://wiki.ecmascript.org/doku.php?id=strawman:array_fill_and_move 
> for a strawman proposal for two new Array methods. These are proposed 
> for inclusion in ES6.

I updated the wiki:


  Discussion

Q: Does anyone know of a rationale for why (start, end) might be a 
better design pattern than (start, count) for such operation?

A: Array.prototype.slice uses (start, end) where end is a fencepost to 
facilitate looping over half-open ranges within a larger range. Spec’ing 
count requires subtracting next_start - end, gratuitously. Also, 
consistency with slice and range APIs matters. This should be considered 
carefully in the design.

— /Brendan Eich 
<mailto:%26%23x62%3B%26%23x72%3B%26%23x65%3B%26%23x6e%3B%26%23x64%3B%26%23x61%3B%26%23x6e%3B%26%23x40%3B%26%23x6d%3B%26%23x6f%3B%26%23x7a%3B%26%23x69%3B%26%23x6c%3B%26%23x6c%3B%26%23x61%3B%26%23x2e%3B%26%23x6f%3B%26%23x72%3B%26%23x67%3B> 
2013/06/23 20:31/


/be


More information about the es-discuss mailing list