default constructors and implicit super() insertion

Peter Hall peter.hall at
Fri Jun 22 14:20:33 PDT 2007

I can't see much about this on the wiki export, and it is barely
touched on here:

Two slightly related comments.

Wouldn't it be logical for a default constructor to automatically have
the same signature as the super-class constructor?

Also, if a constructor is defined which has the same signature as the
super constructor, and a call to super() is inserted automatically,
wouldn't it make sense for super() to be passed the same arguments?

In AS3, automatic super() is always called without arguments, which
can result in compile errors. Likewise, if you do not specify a
constructor, the default constructor always has zero arguments. The
result is that I often find myself adding constructors that do nothing
at all, but can be a lot of duplicated code, if there are many

A common AS3 example is extending Error or Event, where you mostly
want the constructors to be the same, for consistency, and the class
may add no functionality at all:

class MyEvent extends Event
     public function MyEvent(type:String, bubbles:Boolean=false,
          super(type, bubbles, cancelable);


More information about the Es4-discuss mailing list