On 18 December 2012 15:29, Adam D. Ruppe <destructionator@gmail.com> wrote:
On Tuesday, 18 December 2012 at 15:19:58 UTC, Iain Buclaw wrote:
Should we take this as an opportunity for other compiler maintainers to implement their own compiler-specific predefined attributes?

I think it'd be great if we used magical full names, but otherwise it is the same as the library. Then they are namespaced and can be shared.

module core.gdc;
struct noreturn {}
// and whatever


Then when you use it, you import core.gdc and use @noreturn. The compiler doesn't define the attribute, but it recognizes the full name of core.gdc.noreturn and gives it special treatment like an intrinsic.

If doing it that way, it would be better to store all predefined attributes into a binary tree.

UserAttributeDeclaration::addPredefinedAttribute("property");  // etc


And have a magical empty module, gcc.attributes, which when imported injects the compiler-specific attributes.

UserAttributeDeclaration::addPredefinedAttribute("noreturn");  // etc


--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';