[Gambas-user] Initial support of class namespaces in master

Benoît Minisini g4mba5 at gmail.com
Tue May 18 02:29:55 CEST 2021


Hi,

As the subject tells you, I have pushed the initial support of class 
namespaces in the master.

This is done through a new syntax of the EXPORT keyword:

EXPORT AS <NameSpace>:<Name>

And allowing to have a colon inside a class name.

This syntax exports a class by using "<NameSpace>:<Name>" as its public 
name, instead of the name of the class in the project.

Outside of the project, you will have to use "NameSpace:Name" to use the 
class.

Inside the project, you should be able to use "NameSpace:Name" or the 
internal name of the class indifferently.

Note that now a class can now be exported with a different name.

Namespaces do not really exist inside the interpreter or the compiler. 
It's just the part of the class name before the colon.

In the future, I will add the ability to choose a default namespace in 
the project properties, so that the "EXPORT" keyword alone directly 
exports the class to that namespace.

Or a syntax EXPORT TO NameSpace as syntactic sugar for EXPORT AS 
NameSpace:<ProjectClassName>, where <ProjectClassName> is the name of 
the class in the project.

Tell me what you think, and more important if you find problems with 
that new feature.

Regards,

-- 
Benoît Minisini


More information about the User mailing list