Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
November 08, 2004 how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bastiaan Veelo | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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 Re: how to avoid infinite import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | 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. |
Copyright © 1999-2021 by the D Language Foundation