Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
September 30, 2003 BUG?: Private imports -> Forward references | ||||
---|---|---|---|---|
| ||||
Hi! I have mentioned this problem before, and after some looking and the creation of a minimal example, I feel that I have created a good case. Doing dmd -c bar.d produce foo2.d: class foo2 forward reference of base class bar Doing dmd -c bar.d foo1.d foo2.d yields the same Doing dmd -c foo1.d foo2.d bar.d works without a hitch. According to the D lang spec quote: " If the import is private, such as: module abc; private import def; then def is not searched when another module imports abc. " In my example, foo2 is clearly searched, even though it's a private import in the imported module. If such circular forward references really is a problem, then private imports must be the way to fix them. Personally, I believe that this is a bug since it only pops up when foo2 (as a subclass) is imported (indirectly and wrongly in this case) into the module where the base class is defined. -------------- module bar; private import foo1; class bar { } -------------- module foo1; private import foo2; class foo1 { } --------------- module foo2; private import bar; class foo2 : bar { } --------------- Lars Ivar Igesund |
November 13, 2003 Re: Private imports -> Forward references | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | It would be really nice if this bug could be either verified or falsified. Such forward reference messages are real pain in the a** as it means that the project must be compiled all at once (not one and one file using -c). And when all files are used as input at once, the error messages are way too unclear because they assumes that you use only one input file and thus the offending file name isn't printed (which is no good when there are 20+ source files.). Lars Ivar Igesund "Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message news:blbji1$2un5$1@digitaldaemon.com... > Hi! > > I have mentioned this problem before, and after some > looking and the creation of a minimal example, I feel > that I have created a good case. > > Doing > dmd -c bar.d > produce > foo2.d: class foo2 forward reference of base class bar > > Doing > dmd -c bar.d foo1.d foo2.d > yields the same > > Doing > dmd -c foo1.d foo2.d bar.d > works without a hitch. > > According to the D lang spec > quote: > " > If the import is private, such as: > > module abc; > private import def; > > then def is not searched when another module imports abc. > " > > In my example, foo2 is clearly searched, even though it's > a private import in the imported module. If such circular > forward references really is a problem, then private imports > must be the way to fix them. Personally, I believe that this > is a bug since it only pops up when foo2 (as a subclass) is > imported (indirectly and wrongly in this case) into the module > where the base class is defined. > > -------------- > > module bar; > > private import foo1; > > class bar { > > } > > -------------- > > module foo1; > > private import foo2; > > class foo1 { > > } > > --------------- > > module foo2; > > private import bar; > > class foo2 : bar { > > } > > --------------- > > Lars Ivar Igesund > > |
January 06, 2004 Re: Private imports -> Forward references | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | "Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message news:bovno1$316c$1@digitaldaemon.com... > It would be really nice if this bug could be either verified or > falsified. Such forward reference messages are real pain in > the a** as it means that the project must be compiled all at > once (not one and one file using -c). And when all files are > used as input at once, the error messages are way too unclear > because they assumes that you use only one input file and thus > the offending file name isn't printed (which is no good when there > are 20+ source files.). I agree it's a problem. I'm not sure what to do about it, but I'll keep it in the bug list until it is properly resolved. |
February 27, 2004 Re: Private imports -> Forward references | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I am also starting to see this problem in my code. IMHO, one of the great selling points of D is that you can import other modules whilly-nilly without having to worry about forward references and other C header nightmares. This bug undercuts that feature.
Walter, I know you know about this bug. I'm just hoping I can push this to the top of the heap :)
Russ
Walter wrote:
> "Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message
> news:bovno1$316c$1@digitaldaemon.com...
>
>>It would be really nice if this bug could be either verified or
>>falsified. Such forward reference messages are real pain in
>>the a** as it means that the project must be compiled all at
>>once (not one and one file using -c). And when all files are
>>used as input at once, the error messages are way too unclear
>>because they assumes that you use only one input file and thus
>>the offending file name isn't printed (which is no good when there
>>are 20+ source files.).
>
>
> I agree it's a problem. I'm not sure what to do about it, but I'll keep it
> in the bug list until it is properly resolved.
>
>
|
Copyright © 1999-2021 by the D Language Foundation