I can't see much about this on the wiki export, and it is barely
touched on here:
http://www.mozilla.org/js/language/es4/core/classes.html#superconstructor

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
arguments.

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,
cancelable:Boolean=false)
     {
          super(type, bubbles, cancelable);
     }
}



Peter
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to