[Gambas-user] Overriding Color class

Benoît Minisini g4mba5 at gmail.com
Tue Oct 27 19:07:51 CET 2020

Le 18/10/2020 à 01:21, Bruce a écrit :
> On 18/10/20 9:37 am, Benoît Minisini wrote:
>> Le 18/10/2020 à 01:02, Bruce a écrit :
>>> So, this is no longer true:
>>> 4.4. Project symbol table
>>> Your project has its own private symbol, like any component, and can 
>>> export any of its classes to the global symbol table by using the 
>>> EXPORT keyword.
>>> The project classes are loaded after all components. So your exported 
>>> class can override any exported classes declared in any component.
>>> ?
>>> b
>> You must take chapter 3.5 into account too.
> A read/write property must be overridden by a read/write property.
> A read-only property must be overridden by a read-only property.
> Why? 

Because of dynamic inheritance and symbol dispatching.

if class B inherits class A while overriding the X property, then a 
reference on a class A object may be actually a reference on a class B 
object, and so the public interface cannot change because of the 

Inheritance is not solved statically at compilation time, but 
dynamically at runtime. So the compiled bytecode may assume 
possibilities on a symbol dispatching that a later 
inheritance/overriding like you want to do will break.

This is a Gambas object model limitation.


Benoît Minisini

More information about the User mailing list