About Array.of()

Brendan Eich brendan at mozilla.org
Mon Aug 27 12:12:56 PDT 2012


Kevin Smith wrote:
> Isn't there a name that we already use for alternative constructors: 
> create?
>
>     let object = Object.create(null);
>     let array = Array.create("A", "B", "C");

If only create weren't used for Object.create, which takes a pdmap as 
second parameter. That is a complicated beast, with the wrong defaults 
for writable configurable and arguably enumerable.

The Ruby precedent for Array.new appeals to me (and I'm not a Rubyist).

I could live with Array.of but even ignoring search-engine usability, 
using a preposition for a constructor name, rather than a verb or a 
verb'ed adjective, counts against it a tiny bit IMHO.

/be
>
> Kevin
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list