[Gambas-user] Library and File

Benoît Minisini g4mba5 at gmail.com
Thu Nov 15 01:41:08 CET 2018


Le 15/11/2018 à 01:02, Tobias Boege a écrit :
> On Thu, 15 Nov 2018, Benoît Minisini wrote:
>> Can you elaborate with a precise example?
>>
>> Each library already has its own namespace.
>>
>> Only the exported classes share the same namespace, and if two libraries
>> export the same class, then that usually means they want to do the same
>> thing and cannot be used simultaneously.
>>
> 
> For me, the main point, I think, is to be able to make classes available
> without exporting them, and then being able to address and use them
> unambiguously. In the topic of this thread, one could provide a Help.class
> (rather, Help.module if you think about it) in all libraries that care
> to expose their help file to the main program. Since "Help" might be a
> common symbol name to export, the developer might choose not to export
> to avoid overwriting someone else's Help or becoming a Help that is being
> overwritten by someone else.
> 
> In that case, the class should still be available from some prefix:
> 
>    MyLib1::Help.Get()  ' the Help.module from MyLib1.gambas
> 
> (Or any other kind of prefix, like vendor names as Christof suggested.)
> 
> Regards,
> Tobi
> 

What you could have done is defining a unique parent exported class 
named "Help", with "CREATE STATIC" and create an non-exported class 
inheriting "Help" in each library (maybe keeping the "Help" name, i.e. 
reimplement it), then returning a singleton of that class to the caller.

So for me that case is not a strong argument for allowing free access to 
the library namespace from the outside. Or having one name space for 
each library export. I don't know exactly what you suggest.

-- 
Benoît Minisini


More information about the User mailing list