[dmd-internals] imports in functions

Jonathan M Davis jmdavisProg at gmx.com
Tue Jun 21 22:24:50 PDT 2011


On 2011-06-21 22:12, Walter Bright wrote:
> On 6/21/2011 7:34 PM, Jonathan M Davis wrote:
> > Isn't it supposed to be legal to put imports in functions now? A recent
> > commit to std.file does that, and it's failing to compile because of the
> > import within a function.
> 
> Yes, it's supposed to be legal now. Do you have a small test case?

Actually, this incredibly simple case fails:

void func()
{
    import std.regexp;
}

void main()
{
    func();
}

And I don't know how it could get any simpler than that, so that implies to me 
that the feature never actually made it in, but I don't know. But I _am_ using 
the latest HEAD from git, and the autotester is definitely failing because of 
the import in std.file. So, I don't know what's going on with this feature.

- Jonathan M Davis


More information about the dmd-internals mailing list