[Gambas-devel] Arguments of inherited constructors. CHANGE AGAIN!

Benoît Minisini gambas at ...1...
Tue Dec 1 05:12:19 CET 2009


Hi,

I changed the way arguments are consumed by inherited constructors. Yes, 
again!

Now mandatory arguments are consumed first, and then optional arguments if 
there are available arguments.

For example, if you have the following inheritance:

  MyForm --> Form --> Window

with the MyForm constructor being:

  Sub _new(FirstArg As String, SecondArg as Integer, Optional ThirdArg As 
Integer)

The Form constructor takes no argument, and the Window constructor takes an 
optional parent argument.

The signature of the final constructor will be:

  New MyForm(FirstArg As String, SecondArg As Integer, Optional Parent As 
Control, Optional ThirdArg As Integer)

In a more general way, the order of arguments is:

- Mandatory arguments of the final constructor.
- Mandatory arguments of the parent constructor.
- Mandatory arguments of the grand-parent constructor.
... and so on.
- Optional arguments of the final constructor.
- Optional arguments of the parent constructor.
- Optional arguments of the grand-parent constructor.
... and so on.

I hope I was clear. I did that to fix the last "brain-fucking" syntax where 
you had to pass arguments that were optional in the parent class. I think with 
the new syntax, things are better.

Sorry for the inconvenience if you have to rewrite a few lines of code!

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list