[Gambas-user] Gambas bug?

Fabián Flores Vadell fabianfloresvadell at ...626...
Sat Feb 11 01:59:56 CET 2012


2012/2/10 Emil Lenngren <emil.lenngren at ...626...>

> Ok, I understand your issue. But unfortunately, I don't know any good way
> how to do it in Gambas.
>

Well, that's what it is solve this problem by a single method that make a
dinamic call.


> In C++ there are private inheritance that solves the problem, but Gambas
> only has public inheritance.
>
> Maybe Benoit can find out some way how to inherit only "some" of the
> symbols from a base class, if many Gambas programmers want that, and
> disallow such an inherited object to be cast to an ancestor class?
>
> /Emil


I changed my mind about this, few years ago. The problem with inheritance
is that involves an conceptual issue: inheritance implies that an instance
of the subclass "is a" exemplar (specimen) of both, its class and its
superclass, and the subclass is an extension of the behaviour of the
superclass.

So, a subclass that have less behaviour that its superclass is something
that is at odds with the object theory.

In fact, the object theory could prescind from inheritance (as
implementation mechanism) and just support delegation. The Google GO
language is going down that road.

The example that I wrote is very poor. The problem is shown more clearly
when it is considered that an object can have many collaborators and
sometimes the host object will need to expose methods from several of they.
This is the case, and a solution based on inheritance would require a
mechanism to support selective multiple inheritance (Frankenstein and all
his family).

I agree with you about that would be great that the interpreter provide us
a feature that would allow us to do this selectively, but by delegation.

Regards.


-- 
>
Fabián Flores Vadell
www.comoprogramarcongambas.blogspot.com
www.speedbooksargentina.blogspot.com



More information about the User mailing list