prototype focus

Sean Eagan seaneagan1 at
Fri Jul 1 08:51:56 PDT 2011

On Fri, Jul 1, 2011 at 9:38 AM, Mark S. Miller <erights at> wrote:
>> This could be handled by class literals by allowing for default
>> constructors.  If one doesn't provide a constructor, the following one
>> could be provided:
>> constructor(... args) {
>>  super(... args);
>> }
> This one I object to because those used to other languages that provide such
> default constructors will only call the super constructor with no arguments.

I'm sure there is good reason to only default the zero-argument
constructor in languages with multiple constructors per class,
however, ES makes it obvious that there is only one constructor per
class, which class literal syntax reinforces further, so I don't think
users would have a hard time understanding that "a default constructor
merely forwards its arguments to the superclass constructor".  I don't
think users would ever expect arguments passed to a default
constructor not to be forwarded to the superclass constructor.

Sean Eagan

More information about the es-discuss mailing list