Thanks for the pointer!

I like Claude's use-case and recall Allen citing it too. So, two reasons:

1. Higher-order functional programming wants a function, not literal syntax.

2. Subclassing Array works too, thanks to ES6's class-side inheritance.

/be

Rick Waldron <mailto:waldron.r...@gmail.com>
March 3, 2014 at 6:09 AM


On Mon, Mar 3, 2014 at 2:47 AM, Claude Pache <claude.pa...@gmail.com <mailto:claude.pa...@gmail.com>> wrote:


    Le 3 mars 2014 à 04:22, Mark Volkmann <r.mark.volkm...@gmail.com
    <mailto:r.mark.volkm...@gmail.com>> a écrit :

    > What is an example of a use case where one would choose to use
    Array.of instead of the literal array syntax?
    >


Back when Dave Herman and I first dreamed up Array.of, I wrote this up: https://gist.github.com/rwaldron/1074126#arrayof--variable-arity-

Rick



    Here is one case where literal array syntax is not possible:

    class ImprovedArray extends Array { ... }

    let a = ImprovedArray.of( ... )

    —Claude

    _______________________________________________
    es-discuss mailing list
    es-discuss@mozilla.org <mailto:es-discuss@mozilla.org>
    https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Claude Pache <mailto:claude.pa...@gmail.com>
March 2, 2014 at 11:47 PM

Here is one case where literal array syntax is not possible:

class ImprovedArray extends Array { ... }

let a = ImprovedArray.of( ... )

—Claude

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

Mark Volkmann <mailto:r.mark.volkm...@gmail.com>
March 2, 2014 at 7:22 PM
What is an example of a use case where one would choose to use Array.of instead of the literal array syntax?

--
R. Mark Volkmann
Object Computing, Inc.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to