www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Forward reference hell in the DWT. Obviously it's a bug.

reply "Blandger" <zeroman aport.ru> writes:
Here is a full subject story
http://www.dsource.org/forums/viewtopic.php?t=228

I attached the archived source for the 'simplified DWT' version what was
stripped from the real DWT for eliminatig the problem of  D compiler.

The archive has a three version of the same widget classes.

Source folders in it are
\src_fine - is tweaked version. It doesn't have any errors and can be
linked.
\src_crash - crashes the DMD 0.94 and previous versions too
\src_f_ref - gives the forward reference. I can say error description is far
from the clarity and as for me it doesn't give a clue for solving the
problem.

The main difference between those three sources can be found in the
control.d and widget.d files. The 'private import' directive position is
really make sence.

Hope the source will help you Walter to fix a bug because DWT stuck with it
and can't efficiently go further.

Regards, Yuriy.
Jun 30 2004
next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Since not everyone uses SCons (which requires Python), some people might 
find it helpful to have a batch file. This seemed to work for me:

 rem *** build.bat ***
 echo off
cd dwt
cd widgets
dmd composite.d -c -I..\..
dmd control.d -c -I..\..
dmd display.d -c -I..\..
dmd scrollable.d -c -I..\..
dmd widget.d -c -I..\..
pause


I put a copy of this batch file in each of the three main folders.
In src_fine, DMD seemed to work fine.
In src_crash, DMD gave me a GPF.
In src_f_ref, DMD gave me this message (several times):

..\..\dwt\widgets\scrollable.d(7): class Scrollable is forward referenced


Blandger wrote:
 Here is a full subject story
 http://www.dsource.org/forums/viewtopic.php?t=228
 
 I attached the archived source for the 'simplified DWT' version what was
 stripped from the real DWT for eliminatig the problem of  D compiler.
 
 The archive has a three version of the same widget classes.
 
 Source folders in it are
 \src_fine - is tweaked version. It doesn't have any errors and can be
 linked.

So the files can be tweaked, but it takes a lot of effort? I suppose it becomes more and more difficult with more and more files. Thus, DWT would be practically impossible to completely compile. :(
 \src_crash - crashes the DMD 0.94 and previous versions too

I didn't realize any of this stuff crashed! That seems a lot more severe than the "forward reference" error message to me.
 \src_f_ref - gives the forward reference. I can say error description is far
 from the clarity and as for me it doesn't give a clue for solving the
 problem.

That's unfortunate. If the error message is vague or misleading, it's not much better than a crash.
 
 The main difference between those three sources can be found in the
 control.d and widget.d files. The 'private import' directive position is
 really make sence.
 
 Hope the source will help you Walter to fix a bug because DWT stuck with it
 and can't efficiently go further.
 
 Regards, Yuriy.

-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Jun 30 2004
parent "Blandger" <zeroman aport.ru> writes:
 Since not everyone uses SCons (which requires Python), some people might
 find it helpful to have a batch file. This seemed to work for me:

Thanks Justin for this accompaniment. Using Scons is natural to me after I tried it.
 I put a copy of this batch file in each of the three main folders.
 In src_fine, DMD seemed to work fine.
 In src_crash, DMD gave me a GPF.
 In src_f_ref, DMD gave me this message (several times):
 ..\..\dwt\widgets\scrollable.d(7): class Scrollable is forward referenced

That's it.
 So the files can be tweaked, but it takes a lot of effort?

This 'import' placement combination was found using 'brute force', moving imports one by one in those 5 files. I tried to find the rules which can help solving f.ref. but failed.
 I suppose it becomes more and more difficult with more and more files.
 Thus, DWT would be practically impossible to completely compile. :(

You absolutely right.
 \src_crash - crashes the DMD 0.94 and previous versions too

I didn't realize any of this stuff crashed! That seems a lot more severe than the "forward reference" error message to me.

As you see GPF on compiling last file - widget.d
 \src_f_ref - gives the forward reference. I can say error description is


 from the clarity and as for me it doesn't give a clue for solving the
 problem.

That's unfortunate. If the error message is vague or misleading, it's not much better than a crash.

Agree. Regards, Yuriy.
Jun 30 2004
prev sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Wed, 30 Jun 2004 20:22:07 +0300, Blandger wrote:

 Here is a full subject story
 http://www.dsource.org/forums/viewtopic.php?t=228
 
 I attached the archived source for the 'simplified DWT' version what was
 stripped from the real DWT for eliminatig the problem of  D compiler.

$ dmd dwt/*/* -I~/dmd/src/phobos -c compiles all the source trees with no problem - linux 0.94. (read discussion "make utility NOT needed" (or similar) on the old ng) but you are converting from java why don't you have all the imports inside the class bodies? (except the super classes/interfaces) that fails only for the free functions modules. related: people are reporting that DUI compiles with 0.93 and 0.94. Walter, did you change the imports on 0.93? or how the free functions scope if accessed? Ant
Jun 30 2004
parent "Blandger" <zeroman prominvest.com.ua> writes:
 $ dmd dwt/*/* -I~/dmd/src/phobos -c

dmd composite.d control.d display.d scrollable.d widget.d compiles fine for all three source trees.
 but you are converting from java why don't you have all the
 imports inside the class bodies? (except the super classes/interfaces)
 that fails only for the free functions modules.

I don't remember for all DWT code now but almost all classes have private import inside the class body. But this time it doesn't help avoid forward reference in \dwt\widgets\* classes. Yuriy.
Jul 01 2004