version()

Jacob Carlborg doob at me.com
Sun Jan 15 23:28:24 PST 2012


On 2012-01-16 00:44, Manu wrote:
> Why can't I do this:
>
> version( linux || OSX )
> {
>    something common to each
> }
>
> ???
>
>
> This is not acceptable:
>
> version( MinGW )
> {
> version = linuxOrMinGW;
> }
> else version( linux )
> {
> version = linuxOrMinGW;
> }
>
> version( linuxOrMinGW )
> {
>    seriously...?
> }
>
>
> Surely basic logical expressions within a version seem not only logical,
> but also very necessary?
> There must be a reason this is impossible, or else I can't believe it's
> not already like that...

A workaround is to declare variables and use static ifs:

https://github.com/jacob-carlborg/orbit/blob/master/orbit/util/Version.d

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list