[Gambas-user] Class name collision?
taboege at gmail.com
Tue Jun 18 23:00:45 CEST 2019
On Tue, 18 Jun 2019, Yeshua Rodas wrote:
> Hello coders.
> You'll see, I was very happy working on my Gambas project (a Query
> Builder), at the beginning I just wanted to face the String handling and
> construction. Now I have an experimental component y I tried to test in a
> more realistic scenario with the `gb.db` Component.
> I realize now that one of my Classes (`Table`) has the same name of `Table`
> on the `gb.db` Component. So, is there some way to resolve those class name
> collision or I must change my class name?
Namespaces are a feature that has been requested occasionally, but they're
not available yet, sorry.
BTW, the runtime resolves such a naming conflict -- when you export a class
Table while another of the same name already exists in the global symbol
table (via gb.db) -- by merging both classes using the same mechanism that
inheritance would use. This is a cool feature in general and in a particular
case you might end up in a state where your program can run successfully,
but you're really creating some freaky chimera class. I would suggest to
rename your class instead, yes.
If you use other components, watch out for other common names. Request from
gb.web has bitten me before, for instance.
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User