Why version() ?

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Feb 11 11:46:04 PST 2009


On Wed, Feb 11, 2009 at 2:14 PM, Joel C. Salomon <joelcsalomon at gmail.com> wrote:
> Jarrett Billingsley wrote:
>> I use versions for things other than platform-specific code.  Like
>> library compilation options.
>
> So what would your use-case look like?

version(TurnOffSomeFeature) {} else
{
    codeForFeature();
}

Sometimes you want to have things that turn _off_ code from a default
of being on.

I know, I know, Walter said that "[v]ersions should be positive
things, because a version is something that is being build - one
doesn't craft a makefile to build a notLinux."  But the fact is,
platform-specific stuff and code options are two very different use
cases.  Platform-specific things are completely invisible to the user
of a library and only one configuration can ever be in use on a single
platform.  Code options, on the other hand, are based on user
preference.  Some things are extra, and it makes sense to have
switches to turn them on.  But some things are the other way, where
you want them *on* by default and want to have the option of turning
them *off*.



More information about the Digitalmars-d mailing list