I find the fact we can't access a global constant from inside a module through a scope operator a silly idea.
But the requests to change this have been put down so I suppose asking for it again will not change it.
In case you change your mind, that's where my vote is really going and what follows will not be strictly required because it could simply be avoided.
In the meantime: if I want to configure a module at compile time, for example through conditional compilation to include or exclude different part of its code to customize it for various reasons, I have to declare a configuration module and reference it from inside my module (creating an external dependence anyway, so what's the point of preventing the access to the global constant, but let's forget about this).
If my module is called foo I could create a foo_config, something like this:
Code: Select all
DeclareModule foo_config
#magic_conf_option = 1
EndDeclareModule
Module foo
EndModule
Would you at least consider to remove the need to declare the empty module part and not raise an error like PB currently does and implicitly consider the definition of an empty module if missing ?
Code: Select all
DeclareModule foo_config
#magic_conf_option = 1
EndDeclareModule
I don't want to use a (again ugly) macro to generate the empty module part to implement this for just myself locally or to have to distribute them if I want to share a module. Not even sure if it's possible since the macro may be not visible while it's trying to generate the code from inside the declaration it's building.
Anyway I would like this just to work natively. If I only need the declaration part, there is no reason to define the module part too.