[proposal] version statements with multiple arguments.

Walter Bright newshound2 at digitalmars.com
Wed Oct 24 02:18:38 PDT 2012


On 10/22/2012 9:26 PM, timotheecour wrote:
 > Another point is that we are sometimes too lazy to write statements as follows:
 > version (linux){  version = linuxOrBSD;}
 > version (BSD){  version = linuxOrBSD;}
 > version(linuxOrBSD){do_something;}
 > (that's ugly but it's the official recommended way; much more verbose than:
 > version(linux || BSD){do_something;}
 > )

1. Verbosity is not the enemy. Clarity is the goal.

2. The example would be better as:

   version (linux){  version = Something;}
   version (BSD){  version = Something;}
   version(Something){do_Something;}

where Something is the name of the feature being enabled. With careful selection 
of Something, the code can be quite readable.


More information about the Digitalmars-d mailing list