Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John-David Dalton
On Fri, Oct 7, 2011 at 10:17 AM, Jake Verbaten rayn...@gmail.com wrote: Object.extend is the only method I shim on every es5 project, so +1 However arguments like library X is would break are stupid, remember es6 is an opt-in so backwards compat with existing code be damned. No U! My concern

Re: String concatenation

2011-10-07 Thread Tom Schuster
I think you just documented this: http://www.yafla.com/dforbes/String_Concatenation_and_Immutable_Strings_Speeding_Spidermonkey/ On Fri, Oct 7, 2011 at 2:01 AM, Wes Garland w...@page.ca wrote: On 6 October 2011 14:09, Tom Schuster t...@schuster.me wrote: (1) is in  fact really good optimized

Re: On I got 99 problems and JavaScript syntax ain't one

2011-10-07 Thread Mikeal Rogers
On Thu, Oct 6, 2011 at 5:08 AM, Brendan Eich bren...@mozilla.com wrote: On Oct 4, 2011, at 10:52 AM, Mikeal Rogers wrote: But, some of them simply double the semantics and syntax in the language without a path to deprecate previous syntax. I'm a big fan of let, but if you don't deprecate

Re: On I got 99 problems and JavaScript syntax ain't one

2011-10-07 Thread Russell Leggett
On Oct 7, 2011, at 6:51 AM, Mikeal Rogers mikeal.rog...@gmail.com wrote: On Thu, Oct 6, 2011 at 5:08 AM, Brendan Eich bren...@mozilla.com wrote: On Oct 4, 2011, at 10:52 AM, Mikeal Rogers wrote: But, some of them simply double the semantics and syntax in the language without a path

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Quildreen Motta
2011/10/7 John-David Dalton john.david.dal...@gmail.com As for the functionality, it should just be an n-ary function which extends the first object with all the _own_ properties of the other n-1 objects. If keys clash give right precedence. I've used this flavor of extends too (minus

Re: Bug: String.prototype.endsWith

2011-10-07 Thread David Herman
Fixed, thanks. Dave, digging his way out of a massive backlog... On Sep 23, 2011, at 12:18 PM, Axel Rauschmayer wrote: http://wiki.ecmascript.org/doku.php?id=harmony:string_extras I’ve found a small bug: String.prototype.endsWith = function(s) { var t = String(s); return

Re: Grawlix

2011-10-07 Thread David Herman
On this particular issue, I'm inclined to agree -- I think we should be extremely sparing with how many new sigils, if any, we introduce into the language. You'll notice Brendan has repeatedly said similar things about | and .{ for example. Syntax matters. But I feel like now might be a good

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
Several people advocate Object.extend() that copies only own properties. I don't understand why; I'll make the case for copying all properties. At a call site I use, say foo.bar(); Ordinarily I should not be concerned about details of bar()'s implementation. In particular I should not be

Re: Minor issues with proxies

2011-10-07 Thread Tom Van Cutsem
Hi Andreas, - Proxy.create: What if the handler passed is not an object? Should we throw right away? We think the most sensible thing to do is to call ToObject(handler), which will throw right away if the handler is not an object. - Proxy.create: What if the prototype passed is neither an

Re: {Weak|}{Map|Set}

2011-10-07 Thread David Herman
I mostly have a similar approach in mind for tail calls. Precise about the interface, imprecise/informative about the implementation requirements. For WeakMaps, that means a well-defined API with informal English describing the expectations about memory consumption. For tail calls, it means a

Design as a process (was: Re: Grawlix)

2011-10-07 Thread Axel Rauschmayer
From: David Herman dher...@mozilla.com Subject: Re: Grawlix Date: October 7, 2011 15:54:58 GMT+02:00 To: John J Barton johnjbar...@johnjbarton.com Cc: Douglas Crockford doug...@crockford.com, es-discuss@mozilla.org On this particular issue, I'm inclined to agree -- I think we should be

Re: es-discuss Digest, Vol 56, Issue 57

2011-10-07 Thread Axel Rauschmayer
From: John J Barton johnjbar...@johnjbarton.com Subject: Re: Object.extends (was Re: traits feedback) Date: October 7, 2011 16:49:50 GMT+02:00 To: Quildreen Motta quildr...@gmail.com Cc: John-David Dalton john.david.dal...@gmail.com, es-discuss Steen es-discuss@mozilla.org Several people

Re: holes in spread elements/arguments

2011-10-07 Thread David Herman
I don't think we can get away with repurposing _ as a pattern sigil, since it's already a valid identifier and used by popular libraries: http://documentcloud.github.com/underscore/ In my strawman for pattern matching, I used * as the don't-care pattern:

Re: es-discuss Digest, Vol 56, Issue 57

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 8:34 AM, Axel Rauschmayer a...@rauschma.de wrote: *From: *John J Barton johnjbar...@johnjbarton.com *Subject: **Re: Object.extends (was Re: traits feedback)* *Date: *October 7, 2011 16:49:50 GMT+02:00 *To: *Quildreen Motta quildr...@gmail.com *Cc: *John-David Dalton

Re: es-discuss Digest, Vol 56, Issue 57

2011-10-07 Thread Quildreen Motta
2011/10/7 John J Barton johnjbar...@johnjbarton.com On Fri, Oct 7, 2011 at 8:34 AM, Axel Rauschmayer a...@rauschma.de wrote: If you do something like var fuz = Object.extend(foo, {paper:'in', shoes:'my'}); Then fuz will get all properties of Object.prototype, again, as duplicates.

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Axel Rauschmayer
If you do something like var fuz = Object.extend(foo, {paper:'in', shoes:'my'}); Then fuz will get all properties of Object.prototype, again, as duplicates. In the above, you are clearly most interested in what you see in the literal and those are the own properties. I don't

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 9:23 AM, Axel Rauschmayer a...@rauschma.de wrote: If you do something like var fuz = Object.extend(foo, {paper:'in', shoes:'my'}); Then fuz will get all properties of Object.prototype, again, as duplicates. In the above, you are clearly most interested in what you

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Axel Rauschmayer
Sorry to be dense, but I still don't get it. How can an object have duplicate properties? I understand that own properties override properties on prototypes. When you look at the object literal var source = { foo: 123 }; then you have e.g. toString in source === true

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 9:16 AM, Quildreen Motta quildr...@gmail.com wrote: 2011/10/7 John J Barton johnjbar...@johnjbarton.com On Fri, Oct 7, 2011 at 8:34 AM, Axel Rauschmayer a...@rauschma.dewrote: If you do something like var fuz = Object.extend(foo, {paper:'in', shoes:'my'});

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Axel Rauschmayer
Again I'll ask you to consider that fuz.bar() should work. That is what extend means. How can we solve this? It’s possible that you are actually looking for mixins: http://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/ One possible solution is to do 2 extends:

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Quildreen Motta
2011/10/7 John J Barton johnjbar...@johnjbarton.com On Fri, Oct 7, 2011 at 9:16 AM, Quildreen Motta quildr...@gmail.comwrote: 2011/10/7 John J Barton johnjbar...@johnjbarton.com On Fri, Oct 7, 2011 at 8:34 AM, Axel Rauschmayer a...@rauschma.dewrote: If you do something like var

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 10:04 AM, Axel Rauschmayer a...@rauschma.de wrote: Sorry to be dense, but I still don't get it. How can an object have duplicate properties? I understand that own properties override properties on prototypes. When you look at the object literal var source = {

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Axel Rauschmayer
The object |obj| has a property |foo|; the object |proto| has a property |foo|. The string foo appears as property names in two different objects. I don't understand what problem this will cause for developers. The object |obj| does not have duplicate properties, it has a unique value for

Re: Grawlix

2011-10-07 Thread Axel Rauschmayer
From: Allen Wirfs-Brock al...@wirfs-brock.com Subject: Re: Grawlix Date: October 7, 2011 19:56:23 GMT+02:00 To: Quildreen Motta quildr...@gmail.com, John J Barton johnjbar...@johnjbarton.com Cc: es-discuss@mozilla.org For example, we were looking for a more concise way to express

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Allen Wirfs-Brock
(I'm starting a little late on a long thread so sorry if I repeat things that have already been said. On Oct 7, 2011, at 1:50 AM, John-David Dalton wrote: On Fri, Oct 7, 2011 at 10:17 AM, Jake Verbaten rayn...@gmail.com wrote: Object.extend is the only method I shim on every es5 project, so

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 11:08 AM, Axel Rauschmayer a...@rauschma.de wrote: I don’t see a simple way of “fixing” (property descriptors do have their uses) Object.create(). Just allow the second argument to be property descriptor *or* object. Problem: property descriptors are

Re: {Weak|}{Map|Set}

2011-10-07 Thread Mark S. Miller
On Fri, Oct 7, 2011 at 5:23 PM, David Herman dher...@mozilla.com wrote: I mostly have a similar approach in mind for tail calls. Precise about the interface, imprecise/informative about the implementation requirements. For WeakMaps, that means a well-defined API with informal English

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Allen Wirfs-Brock
On Oct 7, 2011, at 9:13 AM, Juan Ignacio Dopazo wrote: On Fri, Oct 7, 2011 at 12:34 PM, Axel Rauschmayer a...@rauschma.de wrote: I would prefer the name Object.copyOwnPropertiesTo(source, target) or Object.copyOwnTo(source, target) to the name “extend” (which, to me, suggests

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread Allen Wirfs-Brock
On Oct 7, 2011, at 9:23 AM, Axel Rauschmayer wrote: ... I would prefer the name Object.copyOwnPropertiesTo(source, target) or Object.copyOwnTo(source, target) to the name “extend” (which, to me, suggests inheritance). I isn't clear from the attribution who said the following. It

Re: Object.extends (was Re: traits feedback)

2011-10-07 Thread John J Barton
On Fri, Oct 7, 2011 at 12:13 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Oct 7, 2011, at 9:23 AM, Axel Rauschmayer wrote: ... I would prefer the name Object.copyOwnPropertiesTo(source, target) or Object.copyOwnTo(source, target) to the name “extend” (which, to me, suggests

Re: holes in spread elements/arguments

2011-10-07 Thread Andreas Rossberg
On 7 October 2011 17:47, David Herman dher...@mozilla.com wrote: I don't think we can get away with repurposing _ as a pattern sigil, since it's already a valid identifier and used by popular libraries: http://documentcloud.github.com/underscore/ In my strawman for pattern matching, I