New __traits

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 26 12:56:37 PST 2015


On Thursday, 26 November 2015 at 17:47:00 UTC, BLM768 wrote:
> Then again, I don't even know whether it's possible for my code 
> to forward-reference an import; if not, pkg will never be null 
> anyway. Maybe I'll just assert it or something...

Yes, code can forward-reference an import. e.g. this code 
compiles just fine:

     void main()
     {
         writeln("Where's my import?");
     }

     import std.stdio;

Now, when the import is inside of a function, then it can't be 
forward-referenced, but that's in line with how variable 
declarations work.

- Jonathan M Davis


More information about the Digitalmars-d mailing list