[Gambas-user] Idea for 3.17

Bruce adamnt42 at gmail.com
Sat May 8 23:11:18 CEST 2021


On 9/5/21 3:15 am, Christof Thalhofer wrote:
> Am 08.05.21 um 14:47 schrieb Bruce:
>> @Brian: It is NOT simple. It is easy to say "Oh, just add a namespace in
>> front of 9notice that I eschewed the word "before") some declaration. I
>> have already posted the number of places that this would be required.
>> And I'll add another to that list ... Inherits
>> Namespacing while retaining so called "backward compatibility" just
>> cannont work! The crux being (yet again) the compiler has absolutely no
>> idea of what the project configuration was BEFORE (in terms of 5 minutes
>> ago), so any ideas that existing code could be differentiated between
>> "what is" and "what was" are impossible.
> I still don't understand what you mean with BEFORE.

Sorry the uppercase was a typo. I am trying to not use that word as it 
has at least 3 different meanings in English.
> But let's look how namespaces could be handled in code:
> Maybe we can do sth like:
> 'Use ... As ...'.*
> (Or we have another way to import a library into a project together with
> an alias, maybe in the Project Dialog which stores that in the
> '.project' file).
> Imagine a library called 'de.deganius.db'. It containes one class: 'Orm'.
> You want to use it inside your project. As it happens, your project also
> contains a class 'Orm'.
> Let us look at a piece of (imaginated) code:
> --------------------------------------------------------
> Public Sub Main()
>      Use de.deganius.db As Degdb
>      Dim DegOrm as New Dgdb.Orm
>      Dim MyOrm as New Orm
>      DegOrm.DoSomething(DegOrm.ConstantA)
>      MyOrm.DoSomethingOther()
> End
> --------------------------------------------------------
> What would be confusing with that? Why wouldn't it be backwards
> compatible? If you remove the lines which have to do with namespaces
> everything is just as before (aka runs in current Gambas).
> Alles Gute
> Christof Thalhofer
> * Like in PHP
Yes, for source code you would be writing just now, it would work.
But imagine 230 projects, libraries and components written over the last 
10 years all of which uae my (un-prefixed) Orm class and use gb.db as 
well. Imagine then that Benoit changes gb.db in Gambas 3.16+ and creates 
a Orm class therein.  As I see it all my source code and p-code would 
then be broken or at least have a high probability of being broken.


More information about the User mailing list