Path: 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 rae@alias.com (Reid Ellis) writes: >Scott Layson Burson writes: >|Suppose we were to introduce a keyword "module" with a simple syntax: >| module Foo { >| // ... declarations >| } >Ron Guilmette writes: >|how about just using `class static { ... }' rather than >|requiring `module '? >Niklas Hallqvist 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 { > // ... >} 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