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

Mark S. Miller erights at
Thu Jul 1 14:49:52 PDT 2010

On Thu, Jul 1, 2010 at 2:31 PM, Jürg Lehni <lists at> 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 it to the constructor by
> adding it to the end of the list of arguments already passed to it. The
> proposal to use it as an initialiser comes from me tinkering with it on the
> Rhino proxy object level by making it automatically initialise the created
> instances. I came to the conclusion that such a use of it is very handy
> without realising this was proposed years ago already, as you pointed out in
> your previous email.
> Do you think something along these lines, or the mentioned 'merge / mixin'
> operator could be discussed to become a future standard?

It is certainly in bounds. Other proposals for perhaps the same "niche" if
you will include the aforementioned classes-as-sugar, Allen's enhanced
object literals, or more direct support for traits (see <>).
My sense is that all of these, and perhaps your upcoming proposal, all have
enough overlap in motivation that only one should be included. My own
preference order is 1) traits, 2) classes-as-sugar, 3) enhanced object
literals. I consider all of these choices to be viable starting points. Only
#1 addresses your desire for mixin-like functionality.

If you agree that your proposal would be, if accepted, an alternative to
these other three, it would be helpful to try stating some pros and cons
compared to these others. Thanks.

> Jürg
> _______________________________________________
> es-discuss mailing list
> es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list