D - imports and forward referencing
- Billy Zelsnack (11/11) Apr 20 2004 I have ported a good chunk of my current project over the last week and
- Billy Zelsnack (2/5) Apr 20 2004
- Ant (5/12) Apr 20 2004 That use to be tipical on previous releases of dmd.
- John Reimer (10/19) Apr 20 2004 Yes, rearranging files has historically fixed some forward referencing
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= (6/9) Apr 21 2004 Interesting... Can you post an example. I haven't been able to find any
- John Reimer (19/33) Apr 21 2004 This technique is not documented so far as I know... I believe Ant
I have ported a good chunk of my current project over the last week and half. Every couple of hours I run across the dreaded.. somerandomclass.d(9): class somerandomclass is forward referenced. I think my past experience with various other languages is messing with my head here. I keep thinking that I have these suckers figured out and then run into the problem again. Eventually after reorganizing things a little I can get it going again, but it just seems like it should work. Could someone post a quick synopsis of the proper way of doing imports. Especially the preferred usage of private imports. To me it seems that imports should almost always be private unless you want to do #include style programming.
Apr 20 2004
Ok. Now I really am confused. This time around I fixed the issue by just rearranging the files on the command line.I have ported a good chunk of my current project over the last week and half. Every couple of hours I run across the dreaded.. somerandomclass.d(9): class somerandomclass is forward referenced.
Apr 20 2004
On Wed, 21 Apr 2004 00:28:24 -0500, Billy Zelsnack wrote:Ok. Now I really am confused. This time around I fixed the issue by just rearranging the files on the command line.That use to be tipical on previous releases of dmd. I thought the dmd 0.82 was better on that. moving the import into the classes bodies is the easy way to fix it. AntI have ported a good chunk of my current project over the last week and half. Every couple of hours I run across the dreaded.. somerandomclass.d(9): class somerandomclass is forward referenced.
Apr 20 2004
Billy Zelsnack wrote:Ok. Now I really am confused. This time around I fixed the issue by just rearranging the files on the command line.Yes, rearranging files has historically fixed some forward referencing issues (but not all). It's probably one of the most frustrating issues in trying to port Java source code to d, I can tell you. You may like to reduce some examples of the forward references into a simple form so that Walter can see it. DMD 0.82 apparently fixed a bunch of these issues. For some reason, if your class inherits by containment of another class, moving the import inside the class definition supposedly fixes the forward reference issues (as Ant indicated). This topic has been discussed on the newsgroup a few times before.I have ported a good chunk of my current project over the last week and half. Every couple of hours I run across the dreaded.. somerandomclass.d(9): class somerandomclass is forward referenced.
Apr 20 2004
John Reimer wrote:For some reason, if your class inherits by containment of another class, moving the import inside the class definition supposedly fixes the forward reference issues (as Ant indicated).Interesting... Can you post an example. I haven't been able to find any post related to this issue. Thanks ----- Julio César Carrascal Urquijo
Apr 21 2004
Julio César Carrascal Urquijo wrote:John Reimer wrote:This technique is not documented so far as I know... I believe Ant discovered it late last year and it apears to have fixed forward referencing issues in his DUI library. I'll refer you to a couple of Ant's threads: http://www.digitalmars.com/drn-bin/wwwnews?D/20837 And Andy Friesen's: http://www.digitalmars.com/drn-bin/wwwnews?D/22093 Others have run into forward referencing issues time and again (including me). DMD 0.82 reportedly fixed a few of these problems. But what bothers me about the "internal" import solution is that it is not formally recognized. It's just one of those things that seems to fix the problem. If it doesn't get documented as a standard approach, those that adopt this technique may be doomed to broken code due to future changes in the compiler. For the DWT project, though, this may be the only method to get around some major issues. SWT has a real problem with classes referencing each other inside and out. Later, JohnFor some reason, if your class inherits by containment of another class, moving the import inside the class definition supposedly fixes the forward reference issues (as Ant indicated).Interesting... Can you post an example. I haven't been able to find any post related to this issue. Thanks ----- Julio César Carrascal Urquijo
Apr 21 2004