[Gambas-user] Idea for 3.17

Christof Thalhofer chrisml at deganius.de
Sun May 9 13:00:25 CEST 2021


Am 09.05.21 um 08:55 schrieb Dimitris Anogiatis:

> I might be a bit late to the conversation but I gotta a few questions.
> 
> What kind of problem are we trying to solve by introducing namespaces?

That we cannot share code which contains classes with the same name. If
I share a library with a class 'Mail' and you want to use it (because it
solves a special problem you have) and at the same time your project
also contains a class 'Mail' your code will break with high probability
if you load my lib.

> Are namespaces the only tool we can use to solve said problem?

No. We can name our classes in an very individual way:

Class DimitrisAnogiatisMail
Class ChristofAtDeganiusMail

(this is poor man's namespacing – nobody does that ... wait ... except
Microsoft in the Windows Registry, am I right?)

Alternatively you can rename the classes in your project so that their
names do not collide with names of classes of foreign libraries you load
into your project.

Alternatively you do without loading foreign libraries. This is what
currently is done in the Gambas world.

> And it also begs the question. What kind of issues are we introducing by
> introducing namespaces into Gambas?

None. Existing code will* behave as always. There will be* a few new
commands and a new operator.

> Do we need to have some sort of a converter from the non-namespaced
> version to a namespaced version of our code (and vice versa) so that
> some sort of compatibility is preserved between Gambas versions?

No.

Alles Gute

Christof Thalhofer

* When I write "will be" then that means only if Benoît wants.

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210509/79032692/attachment.sig>


More information about the User mailing list