Thread overview
how to avoid infinite import?
Nov 08, 2004
clayasaurus
Nov 08, 2004
Bastiaan Veelo
Nov 08, 2004
clayasaurus
Nov 08, 2004
clayasaurus
Nov 08, 2004
clayasaurus
Nov 08, 2004
John Reimer
Nov 08, 2004
Bastiaan Veelo
Nov 08, 2004
Ant
November 08, 2004
hello, i have two modules, lets say module A and B

------------------------
module A;

import B;

B.func();
------------------------

------------------------
module B;

import A;

A.func();
------------------------

i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module?
Thanks.
November 08, 2004
clayasaurus wrote:
> hello, i have two modules, lets say module A and B
> 
> ------------------------
> module A;
> 
> import B;
> 
> B.func();
> ------------------------
> 
> ------------------------
> module B;
> 
> import A;
> 
> A.func();
> ------------------------
> 
> i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module?
> Thanks.

Try it. D is smarter than you think :-)

Bastiaan.
November 08, 2004
In article <cmo1i9$mi5$1@digitaldaemon.com>, clayasaurus says...
>
>hello, i have two modules, lets say module A and B
>
>------------------------
>module A;
>
>import B;
>
>B.func();
>------------------------
>
>------------------------
>module B;
>
>import A;
>
>A.func();
>------------------------
>
>i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module? Thanks.


November 08, 2004
i have two very big classes that are doing this with global class variables. I compile it and it never stops.

Bastiaan Veelo wrote:
> clayasaurus wrote:
> 
>> hello, i have two modules, lets say module A and B
>>
>> ------------------------
>> module A;
>>
>> import B;
>>
>> B.func();
>> ------------------------
>>
>> ------------------------
>> module B;
>>
>> import A;
>>
>> A.func();
>> ------------------------
>>
>> i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module?
>> Thanks.
> 
> 
> Try it. D is smarter than you think :-)
> 
> Bastiaan.
November 08, 2004
nevermind. it never finishes compiling for some other reason :-/

clayasaurus wrote:
> i have two very big classes that are doing this with global class variables. I compile it and it never stops.
> 
> Bastiaan Veelo wrote:
> 
>> clayasaurus wrote:
>>
>>> hello, i have two modules, lets say module A and B
>>>
>>> ------------------------
>>> module A;
>>>
>>> import B;
>>>
>>> B.func();
>>> ------------------------
>>>
>>> ------------------------
>>> module B;
>>>
>>> import A;
>>>
>>> A.func();
>>> ------------------------
>>>
>>> i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module?
>>> Thanks.
>>
>>
>>
>> Try it. D is smarter than you think :-)
>>
>> Bastiaan.
November 08, 2004
clayasaurus wrote:
> i have two very big classes that are doing this with global class variables. I compile it and it never stops.

I don't have D here at the moment, but my project has an import loop and it used to compile. Have not tried the latest releases though. I use private import, but that should not matter much.

Bastiaan.
November 08, 2004
ok. well i just found out that it does compile eventually. it just takes a really long time. it took so long i assumed it was some infinite problem. takes about 10-20 sec to compile a single .d file.

clayasaurus wrote:
> nevermind. it never finishes compiling for some other reason :-/
> 
> clayasaurus wrote:
> 
>> i have two very big classes that are doing this with global class variables. I compile it and it never stops.
>>
>> Bastiaan Veelo wrote:
>>
>>> clayasaurus wrote:
>>>
>>>> hello, i have two modules, lets say module A and B
>>>>
>>>> ------------------------
>>>> module A;
>>>>
>>>> import B;
>>>>
>>>> B.func();
>>>> ------------------------
>>>>
>>>> ------------------------
>>>> module B;
>>>>
>>>> import A;
>>>>
>>>> A.func();
>>>> ------------------------
>>>>
>>>> i'm pretty sure that when i compile it,... it never stops compiling from the infinite import recursion. Both modules need the functions in the other module. How can I avoid this? do i just make it into one module?
>>>> Thanks.
>>>
>>>
>>>
>>>
>>> Try it. D is smarter than you think :-)
>>>
>>> Bastiaan.
November 08, 2004
In article <cmo5mn$t5i$1@digitaldaemon.com>, clayasaurus says...
>
>ok. well i just found out that it does compile eventually. it just takes a really long time. it took so long i assumed it was some infinite problem. takes about 10-20 sec to compile a single .d file.
>

Hmmm... might be similar to the problem DWT is experiencing... except that the DWT compilation eventually crashes dmd with an "out of memory" error.