17 ms·
Yet another great feature heavily inspired from CoffeeScript (and tastefully expanded upon). Well done! The surprising thing for me is that destructuring _almo
by scribu 13y ago
Yet another great feature heavily inspired from CoffeeScript (and tastefully expanded upon). Well done!
The surprising thing for me is that destructuring _almost_ allows defining default values for function arguments.
- mnemonik 13y agoDefault parameter values are also part of ES6.
- bsimpson 13y agoDefault parameter values, ...rest expressions, and modules were all part of ActionScript 3, which was an early implementation of JavaScript Next (then called ECMAScript 4). As I recall, Microsoft and Yahoo! threw a fit about it, and most of the interesting enhancements were shelved. Glad to see some of the good bits making their way back in. The number of times I've had to do function(firstParam, secondParam, thirdParam) { if (firstParam.hasOwnProperty('firstParam') { var argumentDict = firstParam; firstParam = argumentDict['firstParam']; secondParam = argumentDict['secondParam']; thirdParam = argumentDict['thirdParam']; } firstParam = firstParam || "default value"; ... is sickening.
- eurleif 13y agoWhy did Yahoo! care? Why did Yahoo! even have a seat at that table?
- ax 13y agoYahoo did and does have a spot at the table because they are a dues-paying member of ECMA. They have as much weight in the committee as any other member (MS, Google, Mozilla, now Facebook, etc.) Presumably Yahoo cares because they have millions of users running JS code.
- Benvie 13y agoAlso Douglas Crockford worked at Yahoo.
- ax 13y agoI don't think "threw a fit" is an accurate description. More like, objected to many aspects for technical reasons. And, considering that TC-39 agreed at the Oslo meeting to pursue ES3.1 over ES4, presumably they had a pretty good argument. Brendan Eich's mail sent after the accord[1] has some detail. 1) https://mail.mozilla.org/pipermail/es-discuss/2008-August/003400.html https://mail.mozilla.org/pipermail/es-discuss/2008-August/00... (Disclaimer: I work for MS).
- pjscott 13y agoDestructuring assignment long predates Coffeescript. According to the Coffeescript docs, they took the syntax from earlier drafts of ES6. Destructuring assignment long predates ES6. Common Lisp had a destructuring-bind macro back in the early 90s, and I'd bet it wasn't a novel invention back then.
- masklinn 13y agoAnd even in JS-land itself, Mozilla introduced destructuring assignment in Javascript 1.7 (alongside iterators, generators, array comprehensions and `let`). Javascript 1.7 was introduced in Firefox 2, in October 2006. > I'd bet it wasn't a novel invention back then. Indeed, ML featured destructuring assignment (which it called "patterns") of tuples and records back in the 70s.
- Grue3 13y agoThis is the kind of comment that makes me look down on CoffeeScript programmers. I mean, really? You thought Coffeescript invented destructuring bind?
- scribu 13y agoNo, I just thought ES6 took the specific syntax they use from CoffeeScript. As other commenters helpfully pointed out, I was wrong. "CoffeeScript programmers"? Is that a thing?