On 11.07.2011 0:35, Brendan Eich wrote:
On Jul 10, 2011, at 12:02 PM, Dmitry A. Soshnikov wrote:

On 10.07.2011 22:44, Brendan Eich wrote:
On Jul 10, 2011, at 10:40 AM, Dmitry A. Soshnikov wrote:

On 10.07.2011 21:23, Brendan Eich wrote:
On Jul 10, 2011, at 10:18 AM, Rick Waldron wrote:

The more I think about it, I still can't come up with any really exciting use cases where Array.of <http://Array.of/> would outshine anything that already exists. I say strike it from the wishlist.

Higher-order programming with Array as constructing-function bites back for the single-number-argument case. That's where Array.of helps.


You mean when `Array` itself is passed as an argument?

var o = (function (ArrayConstructor, ...rest) {
    return ArrayConstructor(...rest);
})(Array, 10, 20, 30);

Yes. Now consider the case where you leave out the 20 and 30.


return ArrayConstructor(rest[0]) ?

The called function taking ArrayConstructor cannot assume it was passed only one trailing parameter captured by ...rest!


May I ask to show nevertheless how you want to apply here Array.of?

You would pass Array.of instead of Array, of course.


Yes, I've already realized it. Array.of is just a "fixed" version of Array. Though, I'm still thinking how rare/often these cases are.


P.S.:

If this is a wish-list of extending standard array lib, we can consider also the following:

A postscript is no place for more wish list items. See the subject: and start a new thread.

Yes, OK, it will be better.

Dmitry.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to