Should compilers take advantage (abuse) of the new UDA syntax that has been accepted?

Iain Buclaw ibuclaw at ubuntu.com
Tue Dec 18 07:45:43 PST 2012


On 18 December 2012 15:29, Adam D. Ruppe <destructionator at 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';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121218/b99a6429/attachment.html>


More information about the Digitalmars-d mailing list