Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-27 Thread Daniel Friesen
Jürg Lehni wrote: On 30 Jun 2010, at 19:13, Brendan Eich wrote: Some of us old-timers were around at Netscape with Norris Boyd when this was designed and added to Rhino. It was not added to SpiderMonkey, though, for not terribly compelling reasons. Do you remember what the reason wa

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Mark S. Miller
On Thu, Jul 1, 2010 at 2:31 PM, Jürg Lehni wrote: > Brendan, just to clarify: > > > the Rhino > your-constructor-call-with-args+object-initialiser-for-extra-properties > > Rhino does not use the object literal following a constructor call as an > initialiser for extra properties. It just passes i

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Jürg Lehni
Brendan, just to clarify: > the Rhino > your-constructor-call-with-args+object-initialiser-for-extra-properties Rhino does not use the object literal following a constructor call as an initialiser for extra properties. It just passes it to the constructor by adding it to the end of the list of

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Erik Arvidsson
On Thu, Jul 1, 2010 at 12:56, Allen Wirfs-Brock wrote: > var o = { >    [proto: Foo.prototype] >    private _a: 1, >    get a() { return this._a; }, >    set a(a) { this._a = a; } >    }; I like. -- erik ___ es-discuss mailing list es-discuss@mozilla

RE: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Allen Wirfs-Brock
On Behalf Of Erik Arvidsson > Sent: Thursday, July 01, 2010 12:17 PM > To: Mark Miller > Cc: Mark S. Miller; Jürg Lehni; Brendan Eich; es-discuss > Subject: Re: Syntax Proposal: Allow Java-like Object Literals after > constructor > calls to set properties on created objects. >

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Erik Arvidsson
A lot of discussion since I last checked in... I apologize for the harshness. I do agree that Object.create is useful and I agree that the default values for the property descriptor is acceptable even though having read only be the default is painful but consistency trumps that one. My main issue

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Mark Miller
On Thu, Jul 1, 2010 at 11:13 AM, Mark S. Miller wrote: > On Thu, Jul 1, 2010 at 8:24 AM, Brendan Eich wrote: > >> On Jul 1, 2010, at 2:13 AM, Mark S. Miller wrote: >> >> On Wed, Jun 30, 2010 at 9:09 PM, Brendan Eich wrote: >> >>> On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: >>> >>> And you

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Mark S. Miller
On Thu, Jul 1, 2010 at 8:24 AM, Brendan Eich wrote: > On Jul 1, 2010, at 2:13 AM, Mark S. Miller wrote: > > On Wed, Jun 30, 2010 at 9:09 PM, Brendan Eich wrote: > >> On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: >> >> And you're right that attribute-property-missing -> undefined -> false ha

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Brendan Eich
On Jul 1, 2010, at 2:13 AM, Mark S. Miller wrote: > On Wed, Jun 30, 2010 at 9:09 PM, Brendan Eich wrote: > On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: > >> And you're right that attribute-property-missing -> undefined -> false has >> an effect here. If we had kept the ES3 negative names,

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-07-01 Thread Mark S. Miller
On Wed, Jun 30, 2010 at 9:09 PM, Brendan Eich wrote: > On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: > > And you're right that attribute-property-missing -> undefined -> false has >> an effect here. If we had kept the ES3 negative names, we could have >> defaulted to false and Erik (I think)

RE: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Allen Wirfs-Brock
t; default attribute values. Allen From: es-discuss-boun...@mozilla.org [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Maciej Stachowiak Sent: Wednesday, June 30, 2010 9:30 PM To: Brendan Eich Cc: Mark S. Miller; Jürg Lehni; Erik Arvidsson; es-discuss Subject: Re: Syntax Proposal: Al

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Maciej Stachowiak
On Jun 30, 2010, at 9:09 PM, Brendan Eich wrote: > On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: > >> And you're right that attribute-property-missing -> undefined -> false has >> an effect here. If we had kept the ES3 negative names, we could have >> defaulted to false and Erik (I think)

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Brendan Eich
On Jun 30, 2010, at 7:37 PM, Mark S. Miller wrote: > And you're right that attribute-property-missing -> undefined -> false has an > effect here. If we had kept the ES3 negative names, we could have defaulted > to false and Erik (I think) would not find Object.create a mistake -- but > then the

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Mark S. Miller
On Wed, Jun 30, 2010 at 4:31 PM, Brendan Eich wrote: > On Jun 30, 2010, at 4:24 PM, Jürg Lehni wrote: > > > On 30 Jun 2010, at 23:32, Brendan Eich wrote: > > > >> On Jun 30, 2010, at 2:15 PM, Erik Arvidsson wrote: > >> > >>> Sorry, Object.create was a mistake. > >> > >> A bit harsh, but my point

RE: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Allen Wirfs-Brock
alf Of Brendan Eich > Sent: Wednesday, June 30, 2010 4:31 PM > To: Jürg Lehni > Cc: es-discuss; Erik Arvidsson > Subject: Re: Syntax Proposal: Allow Java-like Object Literals after > constructor > calls to set properties on created objects. > > On Jun 30, 2010, at 4:24 PM, J

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Jürg Lehni
On 30 Jun 2010, at 19:13, Brendan Eich wrote: > Some of us old-timers were around at Netscape with Norris Boyd when this was > designed and added to Rhino. It was not added to SpiderMonkey, though, for > not terribly compelling reasons. Do you remember what the reason was why this was added to

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Brendan Eich
On Jun 30, 2010, at 4:24 PM, Jürg Lehni wrote: > On 30 Jun 2010, at 23:32, Brendan Eich wrote: > >> On Jun 30, 2010, at 2:15 PM, Erik Arvidsson wrote: >> >>> Sorry, Object.create was a mistake. >> >> A bit harsh, but my point is not about tone -- it is that the mistake in >> your view is the d

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Jürg Lehni
On 30 Jun 2010, at 23:32, Brendan Eich wrote: > On Jun 30, 2010, at 2:15 PM, Erik Arvidsson wrote: > >> Sorry, Object.create was a mistake. > > A bit harsh, but my point is not about tone -- it is that the mistake in your > view is the default values for missing attributes being false, not true

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Jürg Lehni
On 30 Jun 2010, at 18:26, Jeff Watkins wrote: > Just out of curiosity, what's wrong with the idiomatic Javascript way of > passing an object literal as your last constructor argument? So your example > becomes: > > var stopButton = new ImageButton(this, { > image: getImage('

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Brendan Eich
ething other than the default attribute values > you would have to also add those. > > Allen > > > -Original Message- > > From: es-discuss-boun...@mozilla.org [mailto:es-discuss- > > boun...@mozilla.org] On Behalf Of Jeff Watkins > > Sent: Wednesday,

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Erik Arvidsson
> boun...@mozilla.org] On Behalf Of Jeff Watkins > > Sent: Wednesday, June 30, 2010 10:26 AM > > To: Jürg Lehni > > Cc: es-discuss > > Subject: Re: Syntax Proposal: Allow Java-like Object Literals after > constructor > > calls to set properties on created objects. >

RE: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Allen Wirfs-Brock
day, June 30, 2010 10:26 AM > To: Jürg Lehni > Cc: es-discuss > Subject: Re: Syntax Proposal: Allow Java-like Object Literals after > constructor > calls to set properties on created objects. > > Just out of curiosity, what's wrong with the idiomatic Javascript way of >

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Brendan Eich
On Jun 30, 2010, at 11:13 AM, Brendan Eich wrote: > So, more work needed to avoid a restricted production, at least. A linking > operator or keyword ("with" a la functional record update) would help. (of course I was kidding about "with" :-P) /be ___

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Brendan Eich
On Jun 30, 2010, at 10:05 AM, Jürg Lehni wrote: > I am still interested in hearing more feedback on this. Maybe my examples > were not so clear? > > As more real world example, taken from a UI library that I am working with, > would look like this: > > var stopButton = new ImageButton(th

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Mike Samuel
2010/6/30 Jürg Lehni : > I am still interested in hearing more feedback on this. Maybe my examples > were not so clear? > As more real world example, taken from a UI library that I am working with, > would look like this: > >        var stopButton = new ImageButton(this) { >                imag

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Jeff Watkins
Just out of curiosity, what's wrong with the idiomatic Javascript way of passing an object literal as your last constructor argument? So your example becomes: var stopButton = new ImageButton(this, { image: getImage('stop.png'), size: buttonSize,

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-30 Thread Jürg Lehni
I am still interested in hearing more feedback on this. Maybe my examples were not so clear? As more real world example, taken from a UI library that I am working with, would look like this: var stopButton = new ImageButton(this) { image: getImage('stop.png'),

Re: Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-08 Thread Mike Samuel
A lot of people put opening semicolons on a new line, including the Rhino authors. How would semicolon insertion in this proposal interact with that formatting convention? var runnable = new java.lang.Runnable() { run: function () { } }; 2010/6/8 Jürg Lehni : > This

Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.

2010-06-08 Thread Jürg Lehni
This simple proposal is inspired by an extension of Rhino that currently allows to implement its syntax for anonymous Java interface implementation. Here an example that creates an anonymous class implementing the Runnable interface and defining the run method in an anonymous object literal that