6 Sep 17:26
Re: Proposal for Include files/headers
Slawomir Lisznianski <slisznianski <at> c2-lang.org>
2004-09-06 15:26:37 GMT
2004-09-06 15:26:37 GMT
edA-qa wrote:
> Uggh, the world of XML comes to make something simple extremely robust.
> Since, for the most part, people will be using files to define
> namespaces and classes, I suggest a simpler format which must be
> supported by default:
>
> namespace MySpace = file( "dir/dir/file.h2" ) {
> class MyClass = file( "dir/dir/file.h2" );
> }
>
Indeed, the above is far more readable.
> Here is where my intent differed from users. I do not intend for
> "import" to move things out of their namespace, that would cause the
> same sort of name clashes that exist in Java.
>
> What you are proposing is that "using" does both the "import" and the
> "using" directive. While this may be convenient it has many pitfalls
> for name clashes, consider first in my syntax:
Let me clarify. One could use qualified names, in which case "using"
could be omitted and name clashes prevented. In other words, you don't
need to write "using" if you plan on explicitly qualifying a type.
Also, I opt for importing namespaces and not individual classes because
we *want* to pull any free functions, such as operator+, defined for
those classes. In order to make it safe and efficient, we would have to
go away from the existing C++ practice, where, for example, an entire
std. library is in one namespace. A given bottom-level namespace would
(Continue reading)
RSS Feed