Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-08 Thread Igor Vaynberg
> On Jan 7, 2017, at 4:45 AM, Alexander Jones wrote: > > Hi Igor > > With `super()` and closure binding of the anonymous class `constructor` (as > with all class methods) you can basically solve your problem of constructor > arguments appearing in the wrong place: > > ``` >

Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-07 Thread Alexander Jones
Hi Igor With `super()` and closure binding of the anonymous class `constructor` (as with all class methods) you can basically solve your problem of constructor arguments appearing in the wrong place: ``` this.add( new class extends ArrayView { constructor() { super("items",

Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-07 Thread T.J. Crowder
Two aspects to this: Motivations and syntax. ## On motivations: Addressing new syntax, the first question has to be: Is this use case sufficiently common and painful that it needs new syntax? The answer may be yes, but we need to ask the question. Trying to solve it without new syntax with a

Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-06 Thread Igor Vaynberg
> On Jan 6, 2017, at 7:04 PM, Allen Wirfs-Brock wrote: > > (new class extends foo(bar) {…}) > is already valid syntax that means use the value return from calling foo with > argument bar as the superclass of the class that is being instantiated. What > you propose would

Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-06 Thread Allen Wirfs-Brock
(new class extends foo(bar) {…}) is already valid syntax that means use the value return from calling foo with argument bar as the superclass of the class that is being instantiated. What you propose would be a breaking change. ___ es-discuss mailing

Re: Proposal: Improve syntax for inline anonymous class instantiations

2017-01-06 Thread Matthew Robb
For some reason this idea made me think about adding extends to function syntax: ``` class Foo {} function Bar(a, b) extends Foo { // ... } // Basic sugar for function Baz(a, b) { // ... } Object.setPrototypeOf(Baz, Foo); Object.setPrototypeOf(Baz.prototype, Foo.prototype); ``` Although

Proposal: Improve syntax for inline anonymous class instantiations

2017-01-06 Thread Igor Vaynberg
Given a simple class with an abstract method "populateItem" class ArrayView extends Container { constructor(id, model) { super(id); this.model = model; } // methods referencing "populateItem" omitted for clarity } the current anonymous instantiation syntax looks like