Custom attributes (again)

Timon Gehr timon.gehr at gmx.ch
Fri Apr 6 08:09:59 PDT 2012


On 04/06/2012 05:00 PM, Andrei Alexandrescu wrote:
> On 4/6/12 5:06 AM, Walter Bright wrote:
>> On 4/6/2012 2:41 AM, Johannes Pfau wrote:
>>> The last time custom attributes where discussed, a C# like model was
>>> proposed. Is there a good reason why we should deviate from the C#
>>> implementation?
>>
>> C# uses a runtime implementation, not a compile time one.
>
> Speaking of the distinction, it would be great if we arranged things
> such that attributes are a lowering to existing D (i.e. the compiler
> rewrites a nice attribute syntax into clunky D code you wouldn't want to
> write by hand).
>

What would that look like?

> Lowerings have worked miracles for us in terms of keeping language
> semantics simple and reducing implementation bugs.

What do you have in mind here?

All lowerings I am aware of are trivial ones and their implementation 
resulted in sloppy error handling (eg: foreach) for no clear benefit. 
Some of them (eg: with statement) have even made the implementation bug 
situation worse.

> We should use them
> wherever appropriate.
>
>
> Andrei

I don't think they are in this case. What will help reducing 
implementation bugs is that most of their implementation is already 
covered by the CTFE implementation.


More information about the Digitalmars-d mailing list