Comments on internationalization API

2011-07-19 Thread Norbert Lindenberg
Hi all, I'm sorry for not having been able to contribute to the internationalization API earlier. I finally have reviewed the straw man [1], and am pleased to see that it contains a good subset of internationalization functionality to start with. Number and date formatting and collation are

Re: An extend operator is a natural companion to |

2011-07-19 Thread Axel Rauschmayer
From: Brendan Eich bren...@mozilla.com Date: July 19, 2011 5:59:16 GMT+02:00 To: Allen Wirfs-Brock al...@wirfs-brock.com Cc: es-discuss es-discuss@mozilla.org Subject: Re: An extend operator is a natural companion to | On Jul 18, 2011, at 6:50 PM, Allen Wirfs-Brock wrote: Even in

Re: An extend operator is a natural companion to |

2011-07-19 Thread Axel Rauschmayer
From: Brendan Eich bren...@mozilla.com Date: July 19, 2011 6:09:17 GMT+02:00 To: Rick Waldron waldron.r...@gmail.com Cc: es-discuss es-discuss@mozilla.org Subject: Re: An extend operator is a natural companion to | This is actually close to a less magical syntax that flips around the

Re: An extend operator is a natural companion to |

2011-07-19 Thread Sean Eagan
On Mon, Jul 18, 2011 at 4:01 PM, Brendan Eich bren...@mozilla.com wrote: // replace | with let B = A {...}; // looks like a (prototype) chain link How so? I'm talking about visual similarity with an actual physical chain link. That link is unidirectional. I don't buy it, I'm thinking of

Re: An extend operator is a natural companion to |

2011-07-19 Thread Sean Eagan
On Tue, Jul 19, 2011 at 9:39 AM, Sean Eagan seaneag...@gmail.com wrote: // replace with owns let b = B owns { Sorry, that should have just been... B owns { ... } Thanks, Sean Eagan ___ es-discuss mailing list es-discuss@mozilla.org

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 7:39 AM, Sean Eagan wrote: On Mon, Jul 18, 2011 at 4:01 PM, Brendan Eich bren...@mozilla.com wrote: // replace | with let B = A {...}; // looks like a (prototype) chain link How so? I'm talking about visual similarity with an actual physical chain link. Very visual

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 7:44 AM, Sean Eagan wrote: On Tue, Jul 19, 2011 at 9:39 AM, Sean Eagan seaneag...@gmail.com wrote: // replace with owns let b = B owns { Sorry, that should have just been... B owns { ... } B conquers {...} Half-kidding. The mutating aspect still bothers me.

Re: An extend operator is a natural companion to |

2011-07-19 Thread Dmitry A. Soshnikov
On 19.07.2011 20:59, Brendan Eich wrote: On Jul 19, 2011, at 7:39 AM, Sean Eagan wrote: On Mon, Jul 18, 2011 at 4:01 PM, Brendan Eichbren...@mozilla.com wrote: // replace| with let B = A {...}; // looks like a (prototype) chain link How so? I'm talking about visual similarity with an

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 18, 2011, at 7:24 PM, Axel Rauschmayer wrote: 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

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 10:06 AM, Dmitry A. Soshnikov wrote: Object.extend(src, dest) This is certainly closest to paving the cowpath. Either via a built-in module exporting 'extend', or as you suggest, directly on Object. The Object.extend route is a bit harder to analyze, but not fatally so for

Re: An extend operator is a natural companion to |

2011-07-19 Thread Bob Nystrom
On Mon, Jul 18, 2011 at 6:50 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: But if you were coming from a language where constructors (classes) were real objects with real methods that could reference this and which were inherited by subclass object you might look at the issue quite

Re: An extend operator is a natural companion to |

2011-07-19 Thread Bob Nystrom
On Mon, Jul 18, 2011 at 9:09 PM, Brendan Eich bren...@mozilla.com wrote: 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

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 10:20 AM, Brendan Eich wrote: On Jul 19, 2011, at 10:06 AM, Dmitry A. Soshnikov wrote: Object.extend(src, dest) Oops, except you have the arguments tranposed (thanks to shaver for pointing this out to me). Object.extend(dst, src) or import extend from @obj;

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: This is probably a terrible idea, but in the interest of considering all options, Not terrible at all, and thanks for considering more options. I claim that is what es-discuss is for, so long as you've thought out the pitch and checked to

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: // new lets you declare members on new instances. these would presumably be // invoked on the new object before the constructor body is run. new: numAttacks = 0; // declaring an instance property here mainly so you can document it. could

Re: An extend operator is a natural companion to |

2011-07-19 Thread Bob Nystrom
On Tue, Jul 19, 2011 at 11:16 AM, Brendan Eich bren...@mozilla.com wrote: On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: (It may be that we should use constructor: or static: instead of class:.) Those hurt more. I like class, it is shortest and closest to the keyword that introduces the

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
Ok, I did a side-by-side comparisons of some alternatives. Seehttp://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony%3Aspecification_draftscache=cachemedia=harmony:protooperator_alternatives.pdf The first column is by prototypal inheritance example using| and from the first message in

Re: An extend operator is a natural companion to |

2011-07-19 Thread Bob Nystrom
On Tue, Jul 19, 2011 at 11:23 AM, Brendan Eich bren...@mozilla.com wrote: On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: // new lets you declare members on new instances. these would presumably be // invoked on the new object before the constructor body is run. new: numAttacks = 0;

RE: An extend operator is a natural companion to |

2011-07-19 Thread Luke Hoban
Object.extend(src, dest) This is certainly closest to paving the cowpath. Either via a built-in module exporting 'extend', or as you suggest, directly on Object. The Object.extend route is a bit harder to analyze, but not fatally so for any capable static analysis framework. Either way

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 10:50 AM, Bob Nystrom wrote: On Mon, Jul 18, 2011 at 6:50 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: But if you were coming from a language where constructors (classes) were real objects with real methods that could reference this and which were inherited by

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 11:37 AM, Bob Nystrom wrote: Yeah, I don't like things that look like bare assignment either. I know Mark isn't a fan, but I'd consider: new: var numAttacks = 0; var name; Or maybe let. I like leading with some keyword. Those mislead, although var less so in

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 11:39 AM, Allen Wirfs-Brock wrote: Ok, I did a side-by-side comparisons of some alternatives. Seehttp://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony%3Aspecification_draftscache=cachemedia=harmony:protooperator_alternatives.pdf The first column is by prototypal

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 11:56 AM, Luke Hoban wrote: The arguments in favor of a library alternative are: 1) Immediately useful to all JS developers 2) Simple, understandable syntax consistent with existing practice I agree with all this, but demur here: From discussions with some Microsoft dev

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 11:56 AM, Luke Hoban wrote: Object.extend(src, dest) This is certainly closest to paving the cowpath. Either via a built-in module exporting 'extend', or as you suggest, directly on Object. The Object.extend route is a bit harder to analyze, but not fatally so for any

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 12:10 PM, Brendan Eich wrote: On Jul 19, 2011, at 11:39 AM, Allen Wirfs-Brock wrote: The third column uses Object.specialize and Object.extend calls instead of | and . Note that Object.create can't be used instead of Object.specialize because I want the second

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 12:17 PM, Allen Wirfs-Brock wrote: On Jul 19, 2011, at 11:56 AM, Luke Hoban wrote: Object.extend(src, dest) This is certainly closest to paving the cowpath. Either via a built-in module exporting 'extend', or as you suggest, directly on Object. The Object.extend

RE: An extend operator is a natural companion to |

2011-07-19 Thread Luke Hoban
From discussions with some Microsoft dev teams, that could be a 3+ year difference in adoption timeline. If this is a give me the goods now argument, and the goods can be expressed via functions, I'm with you. If this is new syntax takes too long to be usable due to downrev browsers,

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 11:16 AM, Brendan Eich wrote: On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: // private before a section lets you declare private members on that object. private new: health; Not sure we need 'new' there given lack of private prototype properties in the

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 2:44 PM, Allen Wirfs-Brock wrote: These were largely topics of another thread which I want to get back to with some new thoughts. But these issue may have impact of details of the direct of the design discussion in this thread. I don't think it works to try to add

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 11:23 AM, Brendan Eich wrote: On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote: // new lets you declare members on new instances. these would presumably be // invoked on the new object before the constructor body is run. new: numAttacks = 0; // declaring an

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 3:13 PM, Allen Wirfs-Brock wrote: The plain name; also looks like a useless expression-statement. When we talked some people pretty strongly felt that it was very desirable to be able to explicitly declare the intended per instance properties. In addition to document

Re: An extend operator is a natural companion to |

2011-07-19 Thread Bob Nystrom
On Tue, Jul 19, 2011 at 3:45 PM, Brendan Eich bren...@mozilla.com wrote: On Jul 19, 2011, at 3:13 PM, Allen Wirfs-Brock wrote: The plain name; also looks like a useless expression-statement. When we talked some people pretty strongly felt that it was very desirable to be able to explicitly

Re: An extend operator is a natural companion to |

2011-07-19 Thread Allen Wirfs-Brock
On Jul 19, 2011, at 3:45 PM, Brendan Eich wrote: On Jul 19, 2011, at 3:13 PM, Allen Wirfs-Brock wrote: Also, why ; instead of , like in object literals We've been over this before: because methods have braced bodies that should not require either ; or , to be separate from adjacent

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 4:33 PM, Allen Wirfs-Brock wrote: Actually, I'm trying to explore going the other direction. What would it take to allow object literals to use the same syntax as class declarations for the things that they have in common. But why? Even if an object literal is method

Re: An extend operator is a natural companion to |

2011-07-19 Thread Brendan Eich
On Jul 19, 2011, at 6:12 PM, Gavin Barraclough wrote: On Jul 19, 2011, at 12:17 PM, Allen Wirfs-Brock wrote: One issue is that | conceptually modifies the [[Prototype]] of its RHS. As an operator (whether special character or keyword based) we can restrict the RHS to be a literal and