www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - recursive definition error

reply "Frustrated" <Who where.com> writes:
After upgrading to latest dmd, I get the follow error on the code

template Array(T) { alias Array = std.container.Array!T; }

Error: Array!(iDataBlock).Array recursive alias declaration

I don't see anything recursive about it... and the code worked 
before. Any ideas?
Jul 04 2014
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Frustrated:

 After upgrading to latest dmd, I get the follow error on the 
 code

 template Array(T) { alias Array = std.container.Array!T; }
Try to use a different name inside the template, like "Vector". Bye, bearophile
Jul 04 2014
parent reply "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 15:10:14 UTC, bearophile wrote:
 Frustrated:

 After upgrading to latest dmd, I get the follow error on the 
 code

 template Array(T) { alias Array = std.container.Array!T; }
Try to use a different name inside the template, like "Vector". Bye, bearophile
Huh? The template is simply wrapping std.container.Array so I can later on use change it to a different array without breaking code that uses it. As I said, it worked fine before without this recursion problem. Since there is no recursion going on there, it shouldn't be a problem. This seems like a bug/regression. An indirection does not help.
Jul 04 2014
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Frustrated:

 Since there is no recursion going on there, it shouldn't be a 
 problem.
Yes, sorry. In dmd 2.066 this too could work: alias Array(T) = std.container.Array!T; Bye, bearophile
Jul 04 2014
parent reply "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
 Frustrated:

 Since there is no recursion going on there, it shouldn't be a 
 problem.
Yes, sorry. In dmd 2.066 this too could work: alias Array(T) = std.container.Array!T; Bye, bearophile
That just gives more errors. I'm not using 2.066 though... I will revert back to the dmd version I was using when it worked... Hopefully someone can make sure this is not a regression in the mean time... (seems like it is and I don't want to get bit again later on when I upgrade)
Jul 04 2014
parent reply "Stanislav Blinov" <stanislav.blinov gmail.com> writes:
On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
 Frustrated:
 I'm not using 2.066 though...

 I will revert back to the dmd version I was using when it 
 worked... Hopefully someone can make sure this is not a 
 regression in the mean time... (seems like it is and I don't 
 want to get bit again later on when I upgrade)
That template and its instantiation work fine for me on both 2.065 and 2.066b1.
Jul 04 2014
parent reply "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
 On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
 Frustrated:
 I'm not using 2.066 though...

 I will revert back to the dmd version I was using when it 
 worked... Hopefully someone can make sure this is not a 
 regression in the mean time... (seems like it is and I don't 
 want to get bit again later on when I upgrade)
That template and its instantiation work fine for me on both 2.065 and 2.066b1.
Ok, I do not know where this error creeped in at. I do know at one point the code was working fine without any changes I believe. (it's possible though I messed something up) The recursive error seems to be the wrong issue. Trying to diagnose what the problem is now.
Jul 04 2014
parent reply "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 20:25:28 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
 On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
 Frustrated:
 I'm not using 2.066 though...

 I will revert back to the dmd version I was using when it 
 worked... Hopefully someone can make sure this is not a 
 regression in the mean time... (seems like it is and I don't 
 want to get bit again later on when I upgrade)
That template and its instantiation work fine for me on both 2.065 and 2.066b1.
Ok, I do not know where this error creeped in at. I do know at one point the code was working fine without any changes I believe. (it's possible though I messed something up) The recursive error seems to be the wrong issue. Trying to diagnose what the problem is now.
This must be some weird issue with Array or a change in what imports does. e.g., if I do struct apple(T) { } template Array(T) { alias apple!T Array; } Then the code works(except I no longer can use array as an array but I do not get any recursive issues. The compiler I was using when it worked might have been pre 2.064... Or possibly something else is going on that breaks the code. Best I can tell is that the compiler is getting confused between std.container.Array and my Array.
Jul 04 2014
parent reply "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 21:15:02 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 20:25:28 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
 On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
 On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
 Frustrated:
 I'm not using 2.066 though...

 I will revert back to the dmd version I was using when it 
 worked... Hopefully someone can make sure this is not a 
 regression in the mean time... (seems like it is and I don't 
 want to get bit again later on when I upgrade)
That template and its instantiation work fine for me on both 2.065 and 2.066b1.
Ok, I do not know where this error creeped in at. I do know at one point the code was working fine without any changes I believe. (it's possible though I messed something up) The recursive error seems to be the wrong issue. Trying to diagnose what the problem is now.
This must be some weird issue with Array or a change in what imports does. e.g., if I do struct apple(T) { } template Array(T) { alias apple!T Array; } Then the code works(except I no longer can use array as an array but I do not get any recursive issues. The compiler I was using when it worked might have been pre 2.064... Or possibly something else is going on that breaks the code. Best I can tell is that the compiler is getting confused between std.container.Array and my Array.
This seems to be a regression as it works fine in 2.064. The error is not directly due to recursion as far as I can tell but in a template that uses the Array template. Why it breaks the array I have no idea. I will try to create a minimal project for it.
Jul 06 2014
parent reply "Frustrated" <Who where.com> writes:
So, I took all the code surrounding the error message(which was a 
lot of code) and stuck it into one .d file.

No errors! Works as expected.

So, WTF?!?!

I guess now I have to attempt to split the code across modules to 
see WTF is going on? Maybe this is a modules issue. I know some 
of the code I'm using deals with module resolution and there was 
some talk in the main forum about changing something to do with 
modules.

Could this be the issue?

D really needs a better fing way to debug templates or improve 
the error messages. I'm dealing with about 20k lines of code 
spread across about 100 modules and the error messages are 
completely useless as when I put all the code surrounding what it 
says is causing the error, I do not get the error.

Realize, this code works fine in 2.064 so it's not a coding issue 
as if something magical with my fingers when I copy the code from 
the modules into a single .d file. Either something was "fixed" 
or something was "broke"... after all the work I spend trying to 
figure out what was causing the problem, I'm just as clueless.
Jul 06 2014
parent reply "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
On Monday, 7 July 2014 at 02:57:09 UTC, Frustrated wrote:
 So, I took all the code surrounding the error message(which was 
 a lot of code) and stuck it into one .d file.

 No errors! Works as expected.

 So, WTF?!?!

 I guess now I have to attempt to split the code across modules 
 to see WTF is going on? Maybe this is a modules issue. I know 
 some of the code I'm using deals with module resolution and 
 there was some talk in the main forum about changing something 
 to do with modules.

 Could this be the issue?

 D really needs a better fing way to debug templates or improve 
 the error messages. I'm dealing with about 20k lines of code 
 spread across about 100 modules and the error messages are 
 completely useless as when I put all the code surrounding what 
 it says is causing the error, I do not get the error.

 Realize, this code works fine in 2.064 so it's not a coding 
 issue as if something magical with my fingers when I copy the 
 code from the modules into a single .d file. Either something 
 was "fixed" or something was "broke"... after all the work I 
 spend trying to figure out what was causing the problem, I'm 
 just as clueless.
Have you tried dustmite? It can also reduce source code split over several files.
Jul 07 2014
parent "Frustrated" <Who where.com> writes:
On Monday, 7 July 2014 at 09:56:17 UTC, Marc Schütz wrote:
 On Monday, 7 July 2014 at 02:57:09 UTC, Frustrated wrote:
 So, I took all the code surrounding the error message(which 
 was a lot of code) and stuck it into one .d file.

 No errors! Works as expected.

 So, WTF?!?!

 I guess now I have to attempt to split the code across modules 
 to see WTF is going on? Maybe this is a modules issue. I know 
 some of the code I'm using deals with module resolution and 
 there was some talk in the main forum about changing something 
 to do with modules.

 Could this be the issue?

 D really needs a better fing way to debug templates or improve 
 the error messages. I'm dealing with about 20k lines of code 
 spread across about 100 modules and the error messages are 
 completely useless as when I put all the code surrounding what 
 it says is causing the error, I do not get the error.

 Realize, this code works fine in 2.064 so it's not a coding 
 issue as if something magical with my fingers when I copy the 
 code from the modules into a single .d file. Either something 
 was "fixed" or something was "broke"... after all the work I 
 spend trying to figure out what was causing the problem, I'm 
 just as clueless.
Have you tried dustmite? It can also reduce source code split over several files.
Thanks, I'll check it out.
Jul 07 2014
prev sibling parent reply "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
On Friday, 4 July 2014 at 15:07:00 UTC, Frustrated wrote:
 After upgrading to latest dmd, I get the follow error on the 
 code

 template Array(T) { alias Array = std.container.Array!T; }

 Error: Array!(iDataBlock).Array recursive alias declaration

 I don't see anything recursive about it... and the code worked 
 before. Any ideas?
Which version of DMD exactly? This works in DMD git.
Jul 04 2014
parent "Frustrated" <Who where.com> writes:
On Friday, 4 July 2014 at 15:37:52 UTC, Marc Schütz wrote:
 On Friday, 4 July 2014 at 15:07:00 UTC, Frustrated wrote:
 After upgrading to latest dmd, I get the follow error on the 
 code

 template Array(T) { alias Array = std.container.Array!T; }

 Error: Array!(iDataBlock).Array recursive alias declaration

 I don't see anything recursive about it... and the code worked 
 before. Any ideas?
Which version of DMD exactly? This works in DMD git.
I don't remember what I was using before, I think 2.064. I just upgraded to the latest 2.065.2 today and tried to compile some old code and got all these errors. The code was working fine before. Obviously I could have done something that I forgot but the errors are saying the templates are recursive as if the method doesn't work, yet it worked fine before.
Jul 04 2014