version()
Manu
turkeyman at gmail.com
Sun Jan 15 23:33:39 PST 2012
On 16 January 2012 09:28, Jacob Carlborg <doob at me.com> wrote:
> 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<https://github.com/jacob-carlborg/orbit/blob/master/orbit/util/Version.d>
... these aren't acceptable work arounds, in this case, you're written a
whole module to subvert the insanity! :)
At bare minimum, the version list/map/table/whatever it is should be
exposed to static-if, without having to create a module like the one you
just described.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120116/74d0452d/attachment.html>
More information about the Digitalmars-d
mailing list