About Array.of()

Brendan Eich brendan at mozilla.com
Mon Aug 27 11:34:59 PDT 2012


Just FTR, no one is proposing type guarded variants. Maybe they'll be 
wanted later -- so the alterna-constructor method(s) can be named then.

For now, Array.new is polyfill-able on pre-ES5 implementations if you 
are willing to write Array['new'] all over. That is a drag, though.

/be

Matthew Robb wrote:
> I agree with Rick on the general feeling with Array.of
>
> If arguing ambiguity I would argue a better method name for type 
> guarded arrays would be Array.ofType
>
>
> On Sun, Aug 26, 2012 at 8:56 PM, Rick Waldron <waldron.rick at gmail.com 
> <mailto:waldron.rick at gmail.com>> wrote:
>
>
>     On Sunday, August 26, 2012 at 7:30 PM, Brendan Eich wrote:
>
>>     Rick Waldron wrote:
>>>>     But Array.of is not. Maybe Array.new is a good name.
>>>     Array.of is unambiguous with the current ES specification
>>
>>     Array.new is ok too, though -- no problem with a reserved
>>     identifier as
>>     a property name. It's darn nice for Rubyists.
>>
>>     OTOH Array.of matches the preposition pattern used in Array.from.
>>     But I
>>     don't think this trumps Array.new. 
>
>     Nor do I, but I think it poses a problem for polyfilling (which is
>     not a silver bullet).
>
>     +1 Array.new, but I still think Array.of sounds, feels and looks nicer
>
>     Rick
>>     Cc'ing Dave for his thoughts.
>>
>>     /be
>
>
>     _______________________________________________
>     es-discuss mailing list
>     es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>     https://mail.mozilla.org/listinfo/es-discuss
>
>


More information about the es-discuss mailing list