Destructuring and default parameters in functions

2013-06-27 Thread Marius Gundersen
I'm testing some code in the latest version of Firefox, and it seems I'm not able to define default values to function arguments which are destructured. For example: function test([a, b] = [1, 2]){ return a+b; } test([3, 4])//expect 7 test([3])//expect NaN test()//expect 3

Re: Destructuring and default parameters in functions

2013-06-27 Thread Erik Arvidsson
That should work and it works both in Traceur and Continuum. On Thu, Jun 27, 2013 at 6:19 AM, Marius Gundersen gunder...@gmail.com wrote: I'm testing some code in the latest version of Firefox, and it seems I'm not able to define default values to function arguments which are destructured. For

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-27 Thread Jason Orendorff
On Wed, Jun 26, 2013 at 7:54 PM, Dean Landolt d...@deanlandolt.com wrote: On Wed, Jun 26, 2013 at 6:10 PM, Jason Orendorff jason.orendo...@gmail.com wrote: What if iterator is present but not a function? Do you walk the prototype chain anyway? Blow up? Punt and lookup an iterator directly

Re: Destructuring and default parameters in functions

2013-06-27 Thread Allen Wirfs-Brock
On Jun 27, 2013, at 3:19 AM, Marius Gundersen wrote: I'm testing some code in the latest version of Firefox, and it seems I'm not able to define default values to function arguments which are destructured. For example: function test([a, b] = [1, 2]){ return a+b; } test([3,

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-27 Thread Dean Landolt
On Thu, Jun 27, 2013 at 11:56 AM, Jason Orendorff jason.orendo...@gmail.com wrote: On Wed, Jun 26, 2013 at 7:54 PM, Dean Landolt d...@deanlandolt.com wrote: On Wed, Jun 26, 2013 at 6:10 PM, Jason Orendorff jason.orendo...@gmail.com wrote: What if iterator is present but not a

Re: Destructuring and default parameters in functions

2013-06-27 Thread Brandon Benvie
On 6/27/2013 3:19 AM, Marius Gundersen wrote: Or maybe it just isn't implemented in Firefox? This is correct. https://bugzilla.mozilla.org/show_bug.cgi?id=884372 ___ es-discuss mailing list es-discuss@mozilla.org

[Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Tab Atkins Jr.
Has it been discussed yet to add an .update() method to Map and Set, a la Python, which take an iterable (yielding [key, value] for Map, and just value for Set) and add the iterable's entries to the Map/Set? It desugars easily: Map.prototype.update = function(iter) {

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Allen Wirfs-Brock
On Jun 27, 2013, at 4:47 PM, Tab Atkins Jr. wrote: Has it been discussed yet to add an .update() method to Map and Set, a la Python, which take an iterable (yielding [key, value] for Map, and just value for Set) and add the iterable's entries to the Map/Set? It desugars easily:

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Tab Atkins Jr.
On Thu, Jun 27, 2013 at 5:06 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Jun 27, 2013, at 4:47 PM, Tab Atkins Jr. wrote: Has it been discussed yet to add an .update() method to Map and Set, a la Python, which take an iterable (yielding [key, value] for Map, and just value for Set)

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Rick Waldron
On Thu, Jun 27, 2013 at 8:11 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Thu, Jun 27, 2013 at 5:06 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Jun 27, 2013, at 4:47 PM, Tab Atkins Jr. wrote: Has it been discussed yet to add an .update() method to Map and Set, a la Python,

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Tab Atkins Jr.
On Thu, Jun 27, 2013 at 5:26 PM, Rick Waldron waldron.r...@gmail.com wrote: On Thu, Jun 27, 2013 at 8:11 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: In particular, I like that it just returns the modified map/set, so it's easy to chain with, or to immediately return. I was wondering about

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Rick Waldron
On Thu, Jun 27, 2013 at 8:30 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Thu, Jun 27, 2013 at 5:26 PM, Rick Waldron waldron.r...@gmail.com wrote: On Thu, Jun 27, 2013 at 8:11 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: In particular, I like that it just returns the modified

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Kris Kowal
I’ve found it satisfyingly idiomatic to call this `addEach` (for both maps and other collections) in my work on Collections[1]. [1]: https://github.com/montagejs/collections ___ es-discuss mailing list es-discuss@mozilla.org

Re: [Map/Set] Add an .update() method, a la Python?

2013-06-27 Thread Rick Waldron
On Thu, Jun 27, 2013 at 8:37 PM, Rick Waldron waldron.r...@gmail.comwrote: On Thu, Jun 27, 2013 at 8:30 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Thu, Jun 27, 2013 at 5:26 PM, Rick Waldron waldron.r...@gmail.com wrote: On Thu, Jun 27, 2013 at 8:11 PM, Tab Atkins Jr.