The purpose of this DIP is to provide a unified way of providing additional information to an optimizing compiler in a way that is portable across implementations.
DIP56 would create a way to manually control inlining, but would do it in a way that could cause issues with compilers that don't support it. LDC and GDC also both have a couple of their own attributes used to specify certain compiler information.
By providing an attribute at the language level to allow the user to provide additional information to an optimizing compiler, we can speed the acceptance of the addition of new facets of the attributes in the individual implementations, because each implementation will vary in their ability to handle the attributes. If a compiler cannot handle a specific attribute, it will simply ignore it. If the user has specified -vcompiler on the command line, then information about the attributes that are ignored will be dumped. This is an acceptable way to handle a compiler not supporting a specific attribute, because the only attributes that belong in this section are ones that have no functional change. That is to say, the code they are applied on will produce the same result regardless of if a compiler supports the attribute or not.
It is proposed that this be implemented in a fashion similar to UDA's, except that arbitrary identifiers will be allowed within the parenthesis. For DIP56 the result would be:
@compiler(inline, never) @compiler(inline, always) @compiler(inline, default)
This document has been placed in the Public Domain.