Why version() ?

Anders F Björklund afb at algonet.se
Wed Feb 11 01:43:50 PST 2009


Walter Bright wrote:

> 1. Why not version(!feature) ?
> 
> Because cognitive studies show that people just don't see the negation. 
> Secondly, when you see things like:
> 
>     version (!linux) { ... }
> 
> they're almost always wrong. Versions should be positive things, because 
> a version is something that is being build - one doesn't craft a 
> makefile to build a notLinux.

And for code that can't/won't be rewritten, there's the workaround:

version (linux) {} else { ... }

But yeah, using Unix or Posix would be better than using !Windows.
(only problem there being that both those versions are in use now)

--anders



More information about the Digitalmars-d mailing list