Trond wrote:Just forget about UseModule(), and use the full name which starts with the respective module prefix instead.
Again, it defeats the purpose of having a module,
No, not at all.
The
purpose of a
module is to provide a separate name space, where the PB programmer can decide which identifiers (procedures, structures etc.) are "private" to the module, and which other identifiers can be accessed by code from outside the module. So for instance we can have "private" global variables in a module, which means that these variables are global only in that module, but are not known by the rest of the code. In contrast, when we have global variables in normal code, without using any module, these global variables are visible by the whole code. Well, I'm pretty sure these details are old news for you. But this is what the purpose of a module actually is.
Trond wrote: as I could just prefix all names with the module name instead.
No.
It makes a great difference whether we have say
Mod1::MyFunc() or
Mod1_MyFunc().
In the first case, we have a module named
Mod1, in which we can use all advantages that a module offers (private procedures etc., as I have outlined above very shortly). In the second case, we don't have a module.
When we write
UseModule(Mod1) in the main code, then we can later save some typing, because we only have to write
MyFunc() then. But that is not the purpose of modules. Modules were not introduced into PB in order to save typing.
Actually, UseModule() in the way it currently works partly defeats the purpose of having a module! Because the purpose of a module is to provide a separate name space. But in a code where it reads e.g.
Code: Select all
UseModule(Mod1)
UseModule(Mod2)
UseModule(Mod3)
the public parts of the name spaces of the 3 modules are not separate from each other anymore!
Well, because of this feature request it is obvious that you are also not happy with the way UseModule() currently works.
My point was and is, that the most simple and straightforward way to prevent problems IMO is just to do without UseModule(), and to use the module prefix (e.g. Mod1::) instead.
And on no account does doing without UseModule() defeat the purpose of having a module.
I hope I was able to explain the reasons why.