Re: [[Extensible]]and Proxies (Was: Proxy.isProxy )

2011-07-18 Thread David Bruant
Le 18/07/2011 02:58, Brendan Eich a écrit : On Jul 17, 2011, at 3:14 PM, David Bruant wrote: I'm only catching up now on this thread. I have indeed started some work to try to implement an invariant-enforcing implementation of preventExtension rather than fix+become. Just off the top of my

Re: [[Extensible]]and Proxies (Was: Proxy.isProxy )

2011-07-18 Thread David Bruant
Le 18/07/2011 03:03, Brendan Eich a écrit : On Jul 17, 2011, at 6:01 PM, Brendan Eich wrote: See my previous reply, about fixed properties, the fix trap, controlling the [[Class]] of the object the proxy becomes upon fixing, and preserving the (preventExtensions, seal, freeze) distinction

An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
I've recently been experimenting with coding both prototypal and class based object definitions using the various syntactic forms that are currently on the table. Something has emerged from that which has surprised me. I have never been a big fan of the extend method that is provided by a

Re: [[Extensible]]and Proxies (Was: Proxy.isProxy )

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 2:35 AM, David Bruant wrote: Le 18/07/2011 03:03, Brendan Eich a écrit : On Jul 17, 2011, at 6:01 PM, Brendan Eich wrote: See my previous reply, about fixed properties, the fix trap, controlling the [[Class]] of the object the proxy becomes upon fixing, and preserving

Re: Array.prototype.concat result length (ES5.1)

2011-07-18 Thread Jeff Walden
On 07/14/2011 10:04 AM, Allen Wirfs-Brock wrote: It is probably a bug, because array index based operations generally warp around to 0 at 2^32. Freudian slip? :-D Easiest fix is to just add the length-set to concat. For a quick ES5 erratum that seems best to me. Removing all the

Re: [[Extensible]]and Proxies (Was: Proxy.isProxy )

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 2:06 AM, David Bruant wrote: By enforcing ES5 invariants, we actually are trying to enforce things that are enforced for normal objects already. If you haven't read Tom's FixedHandler implementation [1], I encourage you to, because the minimalism of it is quite

Re: Array.prototype.concat result length (ES5.1)

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 10:51 AM, Jeff Walden wrote: Easiest fix is to just add the length-set to concat. For a quick ES5 erratum that seems best to me. Yes, this needs to be in the errata. Removing all the RangeError stuff, and making array indexes just non-negative integers, would be

Re: An extend operator is a natural companion to |

2011-07-18 Thread Sean Eagan
It would also allow declarative non-integer own properties for arrays, and arbitrary own properties to regular expressions, numbers, booleans, and strings, though I can't think of any specific use cases for those off of the top of my head. Also, how about | as opposed to , since it is a dual to |

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
Hawt. A bit rough in that LHS RHS mutates LHS, whereas LHS | RHS is pure and produces a new object (which could be optimized to mutate RHS, note well!). Both | and are operators, to support chaining. Would it be better for to be pure as | is, and make an assignment operator form, LHS = RHS,

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 11:29 AM, Sean Eagan wrote: It would also allow declarative non-integer own properties for arrays, and arbitrary own properties to regular expressions, numbers, booleans, and strings, though I can't think of any specific use cases for those off of the top of my head.

Re: An extend operator is a natural companion to |

2011-07-18 Thread David Bruant
Le 18/07/2011 19:32, Allen Wirfs-Brock a écrit : I've recently been experimenting with coding both prototypal and class based object definitions using the various syntactic forms that are currently on the table. Something has emerged from that which has surprised me. I have never been a big

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 11:32 AM, Brendan Eich wrote: Hawt. A bit rough in that LHS RHS mutates LHS, whereas LHS | RHS is pure and produces a new object (which could be optimized to mutate RHS, note well!). Both | and are operators, to support chaining. Would it be better for to be pure

Re: An extend operator is a natural companion to |

2011-07-18 Thread Bob Nystrom
On Mon, Jul 18, 2011 at 10:32 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: This is a nice declarative way to describe the per instance state but it turns out it doesn't generalize very well to multiple levels of inheritance. This is an important point. I think the reason most OOP languages

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 12:16 PM, Allen Wirfs-Brock wrote: On Jul 18, 2011, at 11:32 AM, Brendan Eich wrote: Hawt. A bit rough in that LHS RHS mutates LHS, whereas LHS | RHS is pure and produces a new object (which could be optimized to mutate RHS, note well!). Both | and are operators,

Re: An extend operator is a natural companion to |

2011-07-18 Thread Sean Eagan
On Mon, Jul 18, 2011 at 1:44 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Also, how about | as opposed to , since it is a dual to | adding own rather than inherited properties? I'd be a bit concerned about  some people getting confused about which direction of the arrow corresponds to

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 1:39 PM, Sean Eagan wrote: On Mon, Jul 18, 2011 at 1:44 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Also, how about | as opposed to , since it is a dual to | adding own rather than inherited properties? I'd be a bit concerned about some people getting confused

Re: Array.prototype.concat result length (ES5.1)

2011-07-18 Thread liorean
On 07/14/2011 10:04 AM, Allen Wirfs-Brock wrote: It is probably a bug, because array index based operations generally warp around to 0 at 2^32. On 18 July 2011 19:51, Jeff Walden jwalden...@mit.edu wrote: Removing all the RangeError stuff, and making array indexes just non-negative integers,

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 1:05 PM, Bob Nystrom wrote: On Mon, Jul 18, 2011 at 10:32 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: This is a nice declarative way to describe the per instance state but it turns out it doesn't generalize very well to multiple levels of inheritance. This

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 1:37 PM, Brendan Eich wrote: On Jul 18, 2011, at 12:16 PM, Allen Wirfs-Brock wrote: On Jul 18, 2011, at 11:32 AM, Brendan Eich wrote: Hawt. A bit rough in that LHS RHS mutates LHS, whereas LHS | RHS is pure and produces a new object (which could be optimized to

Re: An extend operator is a natural companion to |

2011-07-18 Thread Bob Nystrom
On Mon, Jul 18, 2011 at 3:40 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Jul 18, 2011, at 1:05 PM, Bob Nystrom wrote: 2. Familiar from other languages and it works about the same here as it does in those Arguably it doesn't. Java/C# static methods are not

Re: An extend operator is a natural companion to |

2011-07-18 Thread Bob Nystrom
On Mon, Jul 18, 2011 at 4:59 PM, Brendan Eich bren...@mozilla.com wrote: The primary purpose of a class is to define the behavior (methods) of instances. It is describing an abstraction over all the possible instances. The behavior of the singleton class object is typically secondary to the

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 5:31 PM, Bob Nystrom wrote: class Point { constructor(x, y) { this.x = x; this.y = y; } zero() { return new Point(0, 0); } unit() { return new Point(1, 1); } prototype { manhattanDistance() { return Math.abs(this.x) +

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 4:50 PM, Bob Nystrom wrote: On Mon, Jul 18, 2011 at 3:40 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Jul 18, 2011, at 1:05 PM, Bob Nystrom wrote: 2. Familiar from other languages and it works about the same here as it does in those Arguably it doesn't.

Re: An extend operator is a natural companion to |

2011-07-18 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 4:59 PM, Brendan Eich wrote: Word on the street, from folks ranging the skill gamut, is that |, and so on are Perl-ish line noise. We should consider alternatives, even if it means restricted productions. As I've said in the past, I'm generally more in the

An extend operator is a natural companion to |

2011-07-18 Thread Axel Rauschmayer
From: Allen Wirfs-Brock al...@wirfs-brock.com Date: July 18, 2011 19:32:24 GMT+02:00 To: es-discuss es-discuss@mozilla.org Subject: An extend operator is a natural companion to | Definitely a nice dual to | proto | obj What happens if obj is not a literal? Then it would make sense to do

Re: An extend operator is a natural companion to |

2011-07-18 Thread Axel Rauschmayer
From: Bob Nystrom rnyst...@google.com Date: July 19, 2011 2:31:48 GMT+02:00 To: Brendan Eich bren...@mozilla.com Cc: es-discuss es-discuss@mozilla.org Subject: Re: An extend operator is a natural companion to | To me, the important thing with class literals is to use naming consistently. If

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 6:50 PM, Allen Wirfs-Brock wrote: Even in Harmony, many of the new methods being adding are static: Proxy.create(), Proxy.createFunction(), Proxy.isTrapping(), Object.getPropertyDescriptor(), Object.getPropertyNames(), Object.is(), Number.isFinite(), Number.isNan()...

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 7:00 PM, Allen Wirfs-Brock wrote: On Jul 18, 2011, at 4:59 PM, Brendan Eich wrote: Word on the street, from folks ranging the skill gamut, is that |, and so on are Perl-ish line noise. We should consider alternatives, even if it means restricted productions. As

Re: An extend operator is a natural companion to |

2011-07-18 Thread Rick Waldron
Hey Bob, FWIW... class Point { constructor(x, y) { this.x = x; this.y = y; } zero() { return new Point(0, 0); } unit() { return new Point(1, 1); } prototype { manhattanDistance() { return Math.abs(this.x) + Math.abs(this.y); } } }

Re: An extend operator is a natural companion to |

2011-07-18 Thread Brendan Eich
On Jul 18, 2011, at 9:02 PM, Rick Waldron wrote: Hey Bob, FWIW... class Point { constructor(x, y) { this.x = x; this.y = y; } zero() { return new Point(0, 0); } unit() { return new Point(1, 1); } prototype { manhattanDistance() {