Why version() ?

Bill Baxter wbaxter at gmail.com
Wed Feb 11 13:11:58 PST 2009


On Thu, Feb 12, 2009 at 6:02 AM, Jarrett Billingsley
<jarrett.billingsley at gmail.com> wrote:
> On Wed, Feb 11, 2009 at 2:57 PM, Walter Bright
> <newshound1 at digitalmars.com> wrote:
>> Jarrett Billingsley wrote:
>> So I suggest:
>>
>> version (SomeFeature)
>> {
>>    codeForFeature();
>> }
>>
>> is clearer, even if SomeFeature is the default.
>
> It might be clearer in the code, but it's far less intuitive for the
> library user!
>
> And if SomeFeature is _not_ defined by default, it's not a very good
> default, is it!

I thought he meant this:

// once at the top
version(SomeFeatureDisabled) {
} else { version = SomeFeature; }

// in rest of code ...
version (SomeFeature)
{
    codeForFeature();
}

--bb



More information about the Digitalmars-d mailing list