Provide a way to activate new features. We could piggyback off the version feature for this. First we need to know if the "activate new features" feature is supported. We can do this by defining a version in the compiler when it is supported, i.e.
version (CanActivateFeatures)
{
}
If your source code requires new features, you could so something like
version (CanActivateFeatures)
{
//...
}
else static assert(0, "This code does not work with this compiler, it does not support activating new features");
Then to activate new features, you could use versions as well
version (CanActivateFeatures
{
version = EnableInterpolatedStrings;
}
You can also do this:
version (CanActivateFeatures
{
version (SupportsInterpolatedStrings)
{
version = EnableInterpolatedStrings;
}
else static assert (0, "This code requires InterpolatedString support");
}
Provide a way to activate new features. We could piggyback off the
versionfeature for this. First we need to know if the "activate new features" feature is supported. We can do this by defining a version in the compiler when it is supported, i.e.version (CanActivateFeatures) { }If your source code requires new features, you could so something like
Then to activate new features, you could use versions as well
You can also do this: