Why version() ?

bearophile bearophileHUGS at lycos.com
Tue Feb 10 04:04:04 PST 2009


grauzone:
> Unlike version(), cLinux always needs to be defined on the command line. 
> I don't consider this a disadvantage.

I think I don't like that.

But I may like something like this:
static if (__version__ == DMD) {...}
more than:
version(DMD) {...}

It's longer, but it doesn't need the version keyword, it's more uniform and easy anyway to remember and use, and it can be used in more refined ways.

I may even appreciate other boolean constants like:
static if (__debug__) {...}
static if (__unittest__) {...}
static if (__ismain__) {...}

Where bud and similar tools define __ismain__ as true only inside the main module.

Bye,
bearophile



More information about the Digitalmars-d mailing list