On Sat, Apr 20, 2013 at 11:13 AM, Bruce <bbr...@paddys-hill.net> wrote:
> I have a deep hierarchy of classes, seven levels of specialisation so
> far and likely to grow.
wow.

> At level 4, 6 dummy and the 2 real parameters, i.e.
>         hObj = New
>         Level4Class(Null,Null,Null,Null,Null,Null,Source,Name)
>
> This is becoming very painful.
>
> Is there any way to "turn off" the way constructors consume parameters?
It's a core language design decision, so I doubt it.
Personally instead of using the "official" constructor _new I often
have a separate
Init( ) function which is called immediately after instantiation

foo = New MyClass()
foo.Init(someParameter)

Messy, but because .Init( ) is an "ordinary" function in the eyes of
the the Gambas compiler, ancestor
classes to not "consume" parameters in the same way, plus it is only
overridden in the hierarchy when required.

Unfortunately Gambas doesn't allow any change in function signatures,
so if you wanted an extra parameter in a descendant
constructor you would have to have an "Init2" method which then calls
"Me.Init()"

Ian

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to