Re: True Name Spaces, when?



"Hans-Peter Diettrich" <DrDiettrich1@xxxxxxx> wrote in message news:47b685c3@xxxxxxxxxxxxxxxxxxxxxxxxx
[..]
Delphi has inherited true namespaces from Pascal, no need to add any further bloat. Every unit represents an namespace.

A namespace does not tie to one physical file and allows you to create better partitioning than monstrous units like SysUtils or Classes.
Assuming you really have the need to contain all those classes and utility functions in only one namespace (which would be bad implementation and design these days, but let's say we want to do that), you would have the option to create 5 or 6 more manageable code files instead of a huge one.
A namespace is also not tied to an actual compiled file (BPLs in Delphi, assemblies in .NET): you can extend a namespace in additional compiled modules.
And last but not least, real namespaces don't have the circular reference problem Pascal compilers had since TP days and that also helps creating files that are more maintainable.

What might be desireable: an option that requires the qualification of every identifier, with its unit name. Supported by a tool that extends every unqualified identifier in the source code.

And that would not be bloating? <G>

.



Relevant Pages

  • Re: GCC
    ... The header names changed explicitly to ... The Standard says that the standard ... that did not put iostream into the std namespace. ... and compilers change along with them. ...
    (Debian-User)
  • Re: include headers: <X>, <X.h> and global namespaces
    ... >int strlen ... >keep standard library definitions out of the global namespace. ... some compilers have "strlen" as a compiler ... C++ FAQ: http://www.parashift.com/c++-faq-lite/ ...
    (comp.lang.cpp)
  • Re: Code question that involves namespaces, templates and classes
    ... > Because the namespace is the first name found (since it's the first ... > name available in all scopes searched). ... class TBeta: public TAlpha ... Even programmers that create compilers are capabable of making mistakes. ...
    (comp.lang.cpp)
  • Re: Need VC6 workaround for function template
    ... use a real name for the namespace and ... This might require creating another template function (e.g. ... template<typename Target, typename Source> ... sub-standard compilers like that of VC6. ...
    (microsoft.public.vc.language)
  • Re: Are numeric constants in a namespace visible globally?
    ... > Thanks alot for clearing that up, Rob. ... Many compilers implemented the style headers thus: ... namespace std ... C; // ADL ...
    (comp.lang.cpp)