www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - sequence matters

reply Frank Benoit <keinfarbton nospam.xyz> writes:
for a mixin it is important where the template is declared.

mixin T!(int);
template T(t){
 t a;
}

does not work. Error: mixin forward reference to template.

In one module this is no problem. I can modify the sequence.
The problem comes, if the template and the mixin are in different modules.

I have a lot of templates. Working fine with mixins. Now I added the
"import A" to my file "B", and suddenly the compile fails in module "C".
In module "C" i also have an "import A" and there I use mixins with
templates out of A.

Why does the compile of C fail, when I modify B?

Is the template/mixin feature really stable?
Apr 14 2006
parent reply Frank Benoit <keinfarbton nospam.xyz> writes:
Now I can say, it is not my code that is illegal.
I gave dmd with another source file order a try. Putting my module "B"
at the last position. And it works.

But now I know, the feature is not reliable. I will encounter more
problems in future. And I cannot tell /build/ in which order is should
list the source files :(

I will make a bug report.
Apr 14 2006
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Frank Benoit wrote:

 And I cannot tell /build/ in which order is should
 list the source files :(

I think you can with build 2.10
Apr 14 2006
parent reply "Derek Parnell" <derek psych.ward> writes:
On Sat, 15 Apr 2006 03:11:28 +1000, Lars Ivar Igesund  
<larsivar igesund.net> wrote:

 Frank Benoit wrote:

 And I cannot tell /build/ in which order is should
 list the source files :(

I think you can with build 2.10

Build now gives the files to the compiler in the same order that it encounters them. If you have a specific requirement to compile B before A then place B before A on the Build command line, or in a .brf file. -- Derek Parnell Melbourne, Australia
Apr 14 2006
parent reply Frank Benoit <keinfarbton nospam.xyz> writes:
 Build now gives the files to the compiler in the same order that it
 encounters them. If you have a specific requirement to compile B before
 A then place B before A on the Build command line, or in a .brf file.
 

I need it on Linux. I read about actual problems with 2.10 on Linux in your forum. Are the problems solved?
Apr 14 2006
parent "Derek Parnell" <derek psych.ward> writes:
On Sat, 15 Apr 2006 04:39:10 +1000, Frank Benoit <keinfarbton nospam.xyz>  
wrote:

 Build now gives the files to the compiler in the same order that it
 encounters them. If you have a specific requirement to compile B before
 A then place B before A on the Build command line, or in a .brf file.

I need it on Linux. I read about actual problems with 2.10 on Linux in your forum. Are the problems solved?

I hope so. I'll have 2.11 out this weekend sometime. -- Derek Parnell Melbourne, Australia
Apr 14 2006