About Array.of()

Rick Waldron waldron.rick at gmail.com
Mon Aug 27 13:38:05 PDT 2012



On Monday, August 27, 2012 at 3:12 PM, Brendan Eich wrote:

> 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.
> 
> 


Regardless of its repositioning on the right as a property, I would intuitively expect "new" to behave the same way it would as its operator equivalent (for all constructors, not just Array). By no means do I wish to be combative, but I feel strongly that repurposing the same word is user hostile. 

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120827/4ae1a5f7/attachment.html>


More information about the es-discuss mailing list