Final by default?
Ethan
gooberman at gmail.com
Fri Mar 14 07:11:25 PDT 2014
On Friday, 14 March 2014 at 14:02:06 UTC, Steven Schveighoffer
wrote:
>
> And for that point, your demonstration has failed :)
It's an extraordinarily simple use case, but it is still quite a
common pattern in C++ defines, ie:
#ifdef _DEBUG
#define FEATUREA
#define FEATUREB
#define FEATUREC
#else
#define FEATUREB
#define FEATUREC
#endif
#ifdef FEATUREB
...
#endif
In D, that would look a lot like:
debug
{
version = FeatureA;
version = FeatureB;
version = FeatureC;
}
else
{
version = FeatureB;
version = FeatureC;
}
version(FeatureB)
{
...
}
So for an actual use case and not an abstract example, yes, the
way suggested is not convoluted at all.
More information about the Digitalmars-d
mailing list