Article View: comp.std.c++
Article #1049Re: "module" facility for top-level namespace control
From: Niklas Hallqvist
Date: Sat, 27 Apr 1991 04:20
Date: Sat, 27 Apr 1991 04:20
59 lines
2190 bytes
2190 bytes
rae@alias.com (Reid Ellis) writes:
>Scott Layson Burson <gyro@kestrel.edu> writes:
>|Suppose we were to introduce a keyword "module" with a simple syntax:
>| module Foo {
>| // ... declarations
>| }
>Ron Guilmette <rfg@NCD.COM> writes:
>|how about just using `class <identifier> static { ... }' rather than
>|requiring `module <identifier>'?
>Niklas Hallqvist <niklas@appli.se> writes:
>|How about:
>|
>|default class CLASSNAME-LIST {
>| // code goes here;
>|}
>I'd like something similar to Ron's idea, but the other way around:
>static class <identifier> {
> // ...
>}
Aha, you misunderstood me...
My syntax wasn't invented for the declaration of a "module",
but rather as a replacement for the Ada "use"-statement. I like
Ron's original syntax for the declaration, your syntax has the problem
of misunderstanding the definition:
static class X {
// ...
} foo;
which defines "foo" to be a static instance of X with file scope. In your proposal X would be an instance of a "module" X with global scope. Please,
look at this example to understand my thoughts:
class PersistantObjectSystem static {
class Storable {
// ...
}
Storable* fetch():
}
void foo()
{
default class PersistantObjectSystem {
Storable *x = fetch(); // Means:
// PersistantObjectSystem::Storable *x = Persistant::fetch();
}
}
void foo (@x());
--
Niklas Hallqvist Phone: +46-(0)31-40 75 00
Applitron Datasystem Fax: +46-(0)31-83 39 50
Molndalsvagen 95 Email: niklas@appli.se
S-412 63 GOTEBORG, Sweden mcsun!sunic!chalmers!appli!niklas
Technical Details
Message-ID:
<1359@appli.se>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!chalmers.se!appli!niklasReferences:
<1991Apr19.163253.22253@kestrel.edu> <1991Apr19.183922.1982@kodak.kodak.com> <5143@lupine.NCD.COM> <1358@appli.se> <1991Apr25.060721.12694@alias.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!chalmers.se!appli!niklas From: niklas@appli.se (Niklas Hallqvist) Newsgroups: comp.std.c++ Subject: Re: "module" facility for top-level namespace control Keywords: namespace, module Message-ID: <1359@appli.se> Date: 27 Apr 91 04:20:43 GMT References: <1991Apr19.163253.22253@kestrel.edu> <1991Apr19.183922.1982@kodak.kodak.com> <5143@lupine.NCD.COM> <1358@appli.se> <1991Apr25.060721.12694@alias.com> Distribution: comp.std.c++ Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN Lines: 59