why not new instead of constructor?

2011-11-19 Thread Allen Wirfs-Brock
metaIn the following I'm going to use syntax from by class operator strawman: http://wiki.ecmascript.org/doku.php?id=strawman:class_operator However, the basic idea should be applicable to several of the class declarations proposal that are drifting about. BTW, I'm pretty sure that this isn't

Re: why not new instead of constructor?

2011-11-19 Thread Jake Verbaten
[snip] let Point = class { x: 0, //not really needed unless defining an object exemplar y: 0, new(x,y) { this.x = x; this.y=y; } }; Yes this is better, could we go one step further and allow for Point.new(1,2) to work instead of new Point(1,2). If we just

Re: why not new instead of constructor?

2011-11-19 Thread Rick Waldron
Allen, Yes, this makes sense and is desirable. ( the rationale being that the word new in new Point can be connected to what is going to happen when the code in new(){ ... } is executed ) Rick On Sat, Nov 19, 2011 at 1:27 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Nov 19, 2011, at

Re: why not new instead of constructor?

2011-11-19 Thread Brendan Eich
On Nov 19, 2011, at 9:34 AM, Allen Wirfs-Brock wrote: metaIn the following I'm going to use syntax from by class operator strawman: http://wiki.ecmascript.org/doku.php?id=strawman:class_operator However, the basic idea should be applicable to several of the class declarations proposal that

Re: why not new instead of constructor?

2011-11-19 Thread Brendan Eich
On Nov 19, 2011, at 9:54 AM, Axel Rauschmayer wrote: I like the idea of replacing the method name “constructor” with something better, but “new” suggests instantiation *and* initialization to me. Is “init” a possibility? Who said anything about replacing? If we are trying to match or sugar

Re: why not new instead of constructor?

2011-11-19 Thread Axel Rauschmayer
I like the idea of replacing the method name “constructor” with something better, but “new” suggests instantiation *and* initialization to me. Is “init” a possibility? Who said anything about replacing? If we are trying to match or sugar the prototypal pattern, then whatever the

Re: why not new instead of constructor?

2011-11-19 Thread Brendan Eich
On Nov 19, 2011, at 2:58 PM, Axel Rauschmayer wrote: I like the idea of replacing the method name “constructor” with something better, but “new” suggests instantiation *and* initialization to me. Is “init” a possibility? Who said anything about replacing? If we are trying to match or

Re: why not new instead of constructor?

2011-11-19 Thread Brendan Eich
On Nov 19, 2011, at 3:14 PM, Brendan Eich wrote: That's the point: it's not just a method. It is a special form. In classes as proposed where the name was 'constructor', or if it's 'new' as in Dave's http://wiki.ecmascript.org/doku.php?id=strawman:minimal_classes proposal. It is not just