[Gambas-user] Idea for 3.17

Dimitris Anogiatis dosida at gmail.com
Sun May 9 22:50:46 CEST 2021


So if I understand the concept of namespaces, we're talking about merging
code from 2 or more classes inheriting and overriding methods and
properties of those classes.
How would the inheritance mechanism work? For example let's say we have the
mail class and we import my class and yours like this (again if I
understand it correctly... if not please correct me):

import christof:Mail
import dimitris:Mail

does the compiler just take the second one and use it to inherit and
override code from the class above it in the order they were imported?

or do we have the following scheme:

import christof:Mail
import dimitris:Mail (inherits | overrides | inheritsAndOverrides)
christof:Mail


On Sun, May 9, 2021 at 5:01 AM Christof Thalhofer <chrisml at deganius.de>
wrote:

> 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
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210509/35a9fbfc/attachment-0001.htm>


More information about the User mailing list