Re: Is it the spread operator or spread syntax?

2017-07-06 Thread Allen Wirfs-Brock
An element of a programming that has its own distinct syntax rules is sometimes called a “special form”. So … can be called a special form. Or you can think of it as an syntactic element of argument lists, parameter lists, array literals/destructuring, object literals/destructuring, each of

Re: Is it the spread operator or spread syntax?

2017-07-05 Thread Andrew Li
I hadn't though about rest and how it passes multiple values to a function -- so it's definitely not an operator. I would say that since spread/rest syntax doesn't always evaluate to exactly one value, is context-specific (you can't use it standalone), and isn't defined as an operator in the

Re: Is it the spread operator or spread syntax?

2017-07-05 Thread T.J. Crowder
You're not alone in this question; early on, lots of folks called `...` an operator. It isn't. Rest and spread are syntax, just like the commas in a function's parameter declaration list are syntax, not the comma operator. What rest and spread do is outside the realm of what an operator can do. An

Is it the spread operator or spread syntax?

2017-07-05 Thread Andrew Li
It seems as if there's two different ways to refer to the ... punctuator. How should I refer to this: const foo = [bar, ...baz]; MDN seems to suggest it's referred to as 'spread syntax' but its article URL seems to suggest it was initially created under the name 'spread operator' -- and it's