Spread and non objects

John Lenz concavelenz at gmail.com
Thu Nov 4 18:07:27 PDT 2010


It would seem friendlier for the spread operator to treat it them as a empty
array otherwise you end up with code like:

if (x!=null) {
  f(1,2,...x)
} else  {
  f(1,2)
}


On Thu, Nov 4, 2010 at 5:54 PM, Erik Arvidsson <erik.arvidsson at gmail.com>wrote:

> We've run into an edge case with the spread operator. What should
> happen if we try to spread null or undefined?
>
> f(...undefined);
>
> A. Throw an error
> B. Follow the path of Function.prototype.apply and others and special
> case null and undefined and just call f with 0 arguments
>
> --
> erik
> _______________________________________________
> 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/20101104/dc2e83ec/attachment.html>


More information about the es-discuss mailing list