Generic code: @autoconst, @autopure, @autonothrow

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Aug 29 11:57:05 PDT 2010


Couldn't you reuse the version statement for that? At least for a
group of attribute-related functions this might work (but I haven't
tried):

version(pure)
{
    @pure
    void foo() {...}

    @pure
    void bar() {...}
}
else
{
    void foo() {...}
    void bar() {...}
}

For this, I suggest the following:
>
>    @attribute( condition )[ <value> ]
>
> Where <condition> follows the system of template constraints. <value> is
> as above, a comma-separated list of @ributes. If <condition> evaluates
> to true, the @ributes in <value> are applied to whatever follows.
>
> --
> Simen
>


More information about the Digitalmars-d mailing list