About Array.of()

Domenic Denicola domenic at domenicdenicola.com
Mon Aug 27 21:08:52 PDT 2012


Array.fromElements is solid, especially considering how rarely this will be used, especially given that it competes in ES6 code with `...x => [...x]`

On Aug 27, 2012, at 23:42, "程劭非" <csf178 at gmail.com> wrote:

> Yes, as a developer (but not English native speaker), I really feel
> uncomfortable with the name “of”.
> 
> Considering we already have
>    Object.create
>    String.fromCharCode
> 
> To keep align with them, I belive “create” or “fromElements” might be
> better choices.
> 
> 
> 2012/8/27 Shijun He <hax.sfo at gmail.com>:
>> See the screenshots for the "array of" search suggestion in search engine.
>> As a non-English native speaker, I'd like to say the search suggestion
>> of "array of" in non-english languages seems most come from the
>> programmers' input, so it shows how worldwide programmers think what
>> "array of" means ;)
>> 
>> On Mon, Aug 27, 2012 at 10:55 AM, Matthew Robb <matthewwrobb at gmail.com> 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>
>>> 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
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>> 
>>> 
>> 
>> _______________________________________________
>> 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
> 



More information about the es-discuss mailing list