version()
Jacob Carlborg
doob at me.com
Sun Jan 15 23:38:33 PST 2012
On 2012-01-16 08:33, Manu wrote:
> On 16 January 2012 09:28, Jacob Carlborg <doob at me.com
> <mailto: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.
It is a workaround that works, regardless if you think it's acceptable
or not, and I've already done most of the work so you don't have to.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list