Version declaration proposal

Steve Schveighoffer schveiguy at yahoo.com
Wed Feb 11 21:05:50 PST 2009


On Wed, 11 Feb 2009 16:58:38 -0500, Nick Sabalausky wrote:
> 
> // Ok, Windows is a built-in version declared by the language or
> compiler. // Note that on non-Windows platforms, // the "Windows"
> version would still exist, // but it would just be set to false.
> version(Windows)...
> 

This won't work.  This means that older compilers will fail to compile 
newer code just because of version statements.  In addition, a release of 
a new platform means a release of all the compilers on the other 
platforms.

This essentially is a language change every time you add a new compiler-
defined version.  I think there should be some prefix for 'compiler-
defined' versions, which are always extern.  like D_Windows (As Don 
suggested), or maybe even adopt hierarchy style identifiers, kind of like 
java properties:

version(Compiler.Windows)

Any Compiler.* version is assumed to be extern.

-Steve



More information about the Digitalmars-d mailing list