minwin

Bill Baxter dnewsgroup at billbaxter.com
Tue Nov 28 18:00:20 PST 2006


Walter Bright wrote:
> Bill Baxter wrote:
>> The bottom line is, just because D doesn't have negative version 
>> checks, doesn't mean the need for them will go away.  It just means that
>>   "version(X){}else"
>> becomes the spelling of "!version".  I'd personally rather see 
>> !version(X) or not_version(X) than version(X){}else.
> 
> Or perhaps rethink why there is a negative version called X in the first 
> place. For example, if you want:
> 
>     version (!FULL) { }
> 
> it would perhaps be better to redo the version as:
> 
>     version (EMPTY) { }
> 
> I've been through this with my own code, and it definitely improves the 
> readability to think in positive features rather than negative features. 
> Something about how human perception works. Long ago I read that there's 
> some research to back this up.
> 
> For example,
> 
>     version (NOFLOAT) => version (INTONLY)
>     version (NOTWINDOWS) => version (LINUX)

Yeh, makes sense.  So putting a positive spin on it, the thing I want is 
something like version("LIBRARY") or version("CONSOLE")

But that doesn't change the fact that the version basically involves 
leaving out code, so I still will want to do:

       !version(LIBRARY)
       {
             int WinMain(...
       }

In this case what I really want, though, is to have a version(MAIN) 
that's the default, i.e. it's what you get without specifying any 
-version flags to dmd.


--bb



More information about the Digitalmars-d-announce mailing list