default constructors and implicit super() insertion

Brendan Eich brendan at
Tue Jun 26 21:47:24 PDT 2007

On Jun 26, 2007, at 9:36 PM, Peter Hall wrote:

>> Automatic inference of the default ctor signature and default  
>> super-call
>> from the superclass would be fine by me. I'm not sure what other  
>> people
>> think. It'd break AS code.
> I don't think it would break AS code. The only places where the
> behaviour would be different, are places that would currently be a
> compile error. (Unless I missed something, which is possible at this
> time in the evening)

Oh, I see:

class B { function B(a:int){...} ... }
class C extends B { function C(a:int,b:string):super(a){...} ... }

class B { function B(a:string){...} ... }
class C extends B { function C(a:int,b:string):super(b){...} ... }

class B { function B(a:int){...} ... }
class C extends B { function C(b:string):super(42){...} ... }

So why not relieve the programmer from having to write super(a) in  
the first case. Presumably the matching would be type equality for  
all superclass constructor parameter types. It would be an error to  
leave out an explicit super call if the subclass constructor had  
fewer or differently typed parameters.

Seems safe, helps what may be a common case (I don't know -- anyone  
with Flex experience have a count of classes this would help?).


More information about the Es4-discuss mailing list