Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
June 21, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
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. - Jonathan M Davis |
June 21, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis |
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?
|
June 21, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | 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?
I haven't tried to reduce it, but std.file.listDir imports std.regexp on line 3550 of std.file, and that's failing. So, I can try and reduce it, but there is a failing case which is checked in.
- Jonathan M Davis
|
June 21, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | 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
|
June 21, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis |
On 6/21/2011 10:24 PM, Jonathan M Davis wrote:
>
> 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.
>
>
It compiles when I try it.
|
June 22, 2011 [dmd-internals] imports in functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2011-06-21 22:56, Walter Bright wrote:
> On 6/21/2011 10:24 PM, Jonathan M Davis wrote:
> > 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.
Okay. I think I figured out what happened. Somehow-or-other, I'd screwed up my dmd install, and it was pointing at an old binary. The autotester was failing, and I probably made the incorrect assumption that it was for the same reason that it was failing on my box. I fixed my dmd install, and now it works. Sorry for the noise.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation