[Gambas-user] Compiling A Gambas Project

Tobias Boege taboege at ...626...
Sun Dec 1 18:23:42 CET 2013


On Sun, 01 Dec 2013, Nigel Verity wrote:
> 
> 
> 
> Hi Tobi
> 
> Perhaps if I describe a scenario I encountered yesterday you can advise on whether the behaviour should be expected or whether there is actually a bug.
> 
> I always structure my projects using the default approach so that each form has its associated .class file in which the form-specific code resides. However, user-defined functions which may be used on multiple forms I place in a .module file, usually called mdlShared.
> 
> My problem yesterday involved calls to mdlShared.setFontAttributes(). After a bit of redesigning I replaced this function with mdlShared.setFont(). Unfortunately I forgot to remove several calls to .setFontAttributes() even though I had removed the function itself. These calls were not detected by "Compile All" but resulted in runtime errors.
>  		 	   		  

Yes, this is the correct behaviour as a module is only a static class. If
you use a module, you use a "singleton" of that class.

Being a singleton or not, you use an *object* and to support inheritance and
method overriding - which Gambas does for modules - the interpreter needs to
resolve method calls, as in your case, not before runtime.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list