Skip to content

Activate features per source file #61

Description

@marler8997

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");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions