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

Brian G brian at westwoodsvcs.com
Wed May 19 18:12:30 CEST 2021


Ok improper but

  If I put

      Export as MyNames

  and forget the :classname

  there is no error but the class can not be found at runtime inside the module or out.

  Should there be a compile error?

"Failure is the key to success; 
 each mistake teaches us something"  .. Morihei Ueshiba
Brian G

----- On May 17, 2021, at 5:29 PM, Benoît Minisini g4mba5 at gmail.com wrote:

> 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
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


More information about the User mailing list