super.apply(this, arguments)

Nathan de Vries nathan at atnan.com
Sat Dec 22 16:54:12 PST 2007


On 21/12/2007, at 11:56 PM, P T Withington wrote:
> Cute!  So ... is the 'spread' operator that spreads an array of  
> arguments into a parameter list.

Sounds similar to the splat operator of Ruby:

     def foo(first, second, *rest)
       puts first, second, rest.inspect
     end

     foo(1,2)
     => 1 2 []

     foo(1,2,3,4,5)
     => 1 2 [3, 4, 5]

     rest = [3,4,5]
     foo(1,2, *rest)
     => 1 2 [3, 4, 5]

     rest = [3,4,5]
     foo(1,2, rest)
     => 1 2 [[3, 4, 5]]


Cheers,

--
Nathan de Vries



More information about the Es4-discuss mailing list