Topic: Nested namespaces definition


Author: hattons@globalsymmetry.com ("Steven T. Hatton")
Date: Wed, 14 Apr 2004 17:44:41 +0000 (UTC)
Raw View
adeht wrote:

> Why won't the standard allow the following?
>
> namespace MyNS::Private
> {
>     // ...
> }
>

This is something Mathematica supports for its packages. I've wondered the
same thing.  I haven't proposed this for C++ simply because I had not come
across a use for it in C++.  How would such a construct benefit the
language?

--
STH
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: ab4ds@hotmail.com ("adeht")
Date: Wed, 14 Apr 2004 18:58:33 +0000 (UTC)
Raw View
""Steven T. Hatton"" <hattons@globalsymmetry.com> wrote in message
news:P4WdnbJgqdLx8-DdRVn-vA@speakeasy.net...
> This is something Mathematica supports for its packages. I've wondered the
> same thing.  I haven't proposed this for C++ simply because I had not come
> across a use for it in C++.  How would such a construct benefit the
> language?

I didn't search, sorry about that. Here's the proposal:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1524.htm

You can read about the possible uses for that in the paper.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: cpdaniel_remove_this_and_nospam@mvps.org.nospam ("Carl Daniel")
Date: Thu, 15 Apr 2004 05:01:56 +0000 (UTC)
Raw View
"adeht" wrote:
> Why won't the standard allow the following?
>
> namespace MyNS::Private
> {
>     // ...
> }

because

namespace MyNS
{
  namespace Private
  {
    // ...
  }
}

works just fine as-is.

Analogously, you can't write

class MyNS::MyClass
{
  // ...
};

but have to write

namespace MyNS
{
  class MyClass
  {
    //...
  };
}

-cd

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rmaddox@isicns.com (Randy Maddox)
Date: Thu, 15 Apr 2004 05:06:29 +0000 (UTC)
Raw View
ab4ds@hotmail.com ("adeht") wrote in message news:<407c201b$1@news.bezeqint.net>...
> Why won't the standard allow the following?
>
> namespace MyNS::Private
> {
>     // ...
> }
>

Perhaps because you can accomplish what you want with:

namespace MyNS
{
  namespace Private
  {
  }
}

Then anything in Private is accessed as MyNS::Private::whatever.

Randy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: ab4ds@hotmail.com ("adeht")
Date: Tue, 13 Apr 2004 20:18:45 +0000 (UTC)
Raw View
Why won't the standard allow the following?

namespace MyNS::Private
{
    // ...
}

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]