www.digitalmars.com         C & C++   DMDScript  

D - NONE

reply Juarez Rudsatz <juarez someplace.com> writes:
I was reading the D specification. And is a very good job.
But just my 2c :

From specification :

DebugStatement:
debug Statement
debug ( Integer ) Statement
debug ( Identifier ) Statement

int k;
debug
{   int i;
    int k;// error, k already defined     i = 3;
}
x = i;// uses the i declared above

and from a previous post :

This would eliminate the #define brackets:
asm(x86) {
}
asm(ppc) {
}
asm(sparc) {
}

or simply

AsmStatement:
asm Statement
asm ( Integer ) Statement
asm ( Identifier ) Statement

But if you generalize :

ConditionalStatement:
Statement Identifier ;

then can I use the Conditional Statement as like variable

E.g: 
Statement VersionType;

VersionType ( Light ) {
	....
}
Question :
This will replace the #ifdef in a generic and good form ?
This is easy and fast for language ?
And the #ifndef ?
This make sense ?
Aug 24 2001
parent Dan Hursh <hursh infonet.isl.net> writes:
Juarez Rudsatz wrote:
 
 I was reading the D specification. And is a very good job.
 But just my 2c :
 
 From specification :
 
 DebugStatement:
 debug Statement
 debug ( Integer ) Statement
 debug ( Identifier ) Statement
 
 int k;
 debug
 {   int i;
     int k;// error, k already defined     i = 3;
 }
 x = i;// uses the i declared above
 
 and from a previous post :
 
 This would eliminate the #define brackets:
 asm(x86) {
 }
 asm(ppc) {
 }
 asm(sparc) {
 }
 
 or simply
 
 AsmStatement:
 asm Statement
 asm ( Integer ) Statement
 asm ( Identifier ) Statement
 
 But if you generalize :
 
 ConditionalStatement:
 Statement Identifier ;
 
 then can I use the Conditional Statement as like variable
 
 E.g:
 Statement VersionType;
 
 VersionType ( Light ) {
         ....
 }
 Question :
 This will replace the #ifdef in a generic and good form ?
 This is easy and fast for language ?
 And the #ifndef ?
 This make sense ?
It makes sense. It's better than nothing. Considering all the interesting thing that can be done with the configure scripts in most open source programs, I find it really hard to imagine that this will be possible without some form of conditional compiling. Worse yet, people will probably just abuse debug(<identifier>) to get this functionality. Dan
Aug 26 2001