[Gambas-user] New namespace support
Benoît Minisini
g4mba5 at gmail.com
Thu Feb 3 17:38:40 CET 2022
Le 02/02/2022 à 16:40, Gianluigi a écrit :
>
>
> Il giorno mer 2 feb 2022 alle ore 16:24 Benoît Minisini
> <g4mba5 at gmail.com <mailto:g4mba5 at gmail.com>> ha scritto:
>
>
>
> What do not you understand exactly? Have you read the §4.5 in the
> 'Gambas object model' wiki page?
>
> --
> Benoît Minisini
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette
> <http://gambaswiki.org/wiki/doc/netiquette> ]----
>
>
> Hi Benoit,
>
> I understand the theory, but not the practice.
> Can you kindly give a simple example suitable for me :-)
>
The code you posted is right, I can't give you a better example.
I still don't understand what you don't understand. :-)
A class has a name. Its name is stored in a symbol table, that is
private to the project/component/library it is declared in.
An exported class has a second name, a public name, that is stored in
another symbol table, the global symbol table, that is shared by the
project and all components and libraries.
Before namespaces, the public name was always the same as the private
name. As that name is shared by everyone, collisions may occur.
So the namespace feature just allows to choose what the public name is,
using a convention: everything before ':' is the namespace, and two
different people or organization should use different namespaces, to
avoid collisions.
Once your public class name is "GianLuigi:MyClass", you have to use "New
GianLuigi:MyClass" to instanciate the class outside of the
project/component/library it is declared in.
Is it clearer now?
--
Benoît Minisini
More information about the User
mailing list