version: multiple conditions

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 13 14:51:43 PDT 2015


On Sat, 13 Jun 2015 17:29:17 -0400, Xiaoxi <xiaoxi at 163.com> wrote:

> On Saturday, 13 June 2015 at 21:19:28 UTC, bitwise wrote:
>> On Sat, 13 Jun 2015 17:16:04 -0400, weaselcat <weaselcat at gmail.com>  
>> wrote:>
>>> iirc this falls under the "walter dislikes it so we won't have it"  
>>> category.
>>
>> As Andrei said at DConf though, consensus requires at least 3 people ;)
>>
>>   Bit
>
> The current design encourages using more finegrained features instead of  
> the more blunt Os level versions.
>
> version(iOS) { version = pthread;}
> version(Android) { version = pthread;}
>
> In the rest of the file simply check for pthread instead of OS.


That _sounds_ nice, but consider this:

version (linux) {
     import core.sys.linux.dlfcn;
}
else version (FreeBSD) {
     import core.sys.freebsd.dlfcn;
}

version(linux || FreeBSD) {
     dlopen(...)
}

I shouldn't have to add another version just for that last dlopen block.  
It's not "finegrained" control, it's cruft.

     Bit


More information about the Digitalmars-d mailing list