[fpc-devel] Namespaces [was: is that intended? private type section in classes versus visibility]
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Mon Jul 26 02:45:22 CEST 2010
Graeme Geldenhuys schrieb:
> my projects - instead I have to keep coming up with new prefixes. I
> already have gg_utils.pas, mm_utils.pas, fpg_utils.pas, m2c_utils.pas
> for some of my projects. It would be awesome if I can simply use
> utils.pas and define a namespace via a compiler parameter.
How should that work? How to distinguish between <std>utils.pas and
<other>utils.pas, in "using utils;"?
IMO a directory structure has the obvious advantage, that it can be
verified without looking into source code. Namespaces instead are
arbitrary per se, and every part of a module (unit) can be assigned to
an arbitrary namespace. A dedicated tool would have to build the
namespace tree, by inspecting all files (or directories) related to a
project (and installation...), before one (including the compiler) can
know the contents of every namespace qualifier. The compiler would have
to build the namespace tree, in addition to the already existing search
path tree/cache. AFAIK .NET build such an global (system wide) cache for
namespace resolution - should we really add such a beast as a mandatory
requirement for every FPC user? Not to mention the requirement to
install every source file (directories) into that namespace manager...
DoDi
More information about the fpc-devel
mailing list