import question

Timon Gehr timon.gehr at gmx.ch
Wed Jan 25 15:18:15 PST 2012


On 01/25/2012 01:33 PM, Manu wrote:
> On 23 January 2012 12:47, Don Clugston <dac at nospam.com
> <mailto:dac at nospam.com>> wrote:
>
>     On 22/01/12 03:56, Nick Sabalausky wrote:
>
>         "Jonathan M Davis"<jmdavisProg at gmx.com
>         <mailto:jmdavisProg at gmx.com>>  wrote in message
>         news:mailman.670.1327197408.__16222.digitalmars-d at puremagic.__com...
>
>             On Saturday, January 21, 2012 22:28:20 equinox at atw.hu
>             <mailto:equinox at atw.hu> wrote:
>
>                         Should not module C see c1? Because it cannot
>                         see it. Even if the
>                         import
>                         is not private.
>
>
>                     No. imports are private by default There's no point
>                     in marking them as
>                     private. If you want module C to see what module B
>                     is importing, then
>                     module B
>                     needs to import it publicly. e.g.
>
>                     module B;
>
>                     public import A;
>
>                     - Jonathan M Davis
>
>
>                 It makes sense. But did it always work like this?
>
>
>             It has for several years at minimum. But I don't know how it
>             works in D1,
>             and
>             it may have worked differently in the very beginning of D2.
>             I don't know.
>             But
>             as far as I know, it's always worked this way.
>
>
>         I have a vague recollection of it being the other way around at
>         one point,
>         but that probably would have been pre-1.0. *Definitely* pre-2.0.
>         (Or I might
>         just be thinking of something else...)
>
>
>     Version D 0.163 Jul 18, 2006
>     New/Changed Features
>
>         Imports now default to private instead of public. Breaks
>     existing code.
>         Added static imports, renamed imports, and selective importing
>
>
> What is a static import? It sounds like something I might have needed
> last night...

A static import is an import that makes the module visible but does not 
import any of it's members into the current scope:

static import std.stdio;

void main(){
     // writeln("hello, world!");        // undefined symbol
     std.stdio.writeln("hello, world!"); // ok
}




More information about the Digitalmars-d mailing list