Attributes on Enum Members: Call for use cases.

Timon Gehr timon.gehr at gmx.ch
Wed Nov 29 17:20:19 UTC 2017


On 29.11.2017 17:58, Steven Schveighoffer wrote:
> On 11/29/17 11:45 AM, Timon Gehr wrote:
>> On 29.11.2017 17:21, Andrei Alexandrescu wrote:
>>> On 11/29/2017 07:53 AM, Seb wrote:
>>>> UDAs for function arguments would be really awesome to have.
>>>
>>> They should be part of the same DIP. -- Andrei
>>
>> More generally, any declaration should ideally support UDAs.
>>
>> One issue with UDAs on function arguments is that function types will 
>> then have embedded UDAs, so the DIP should specify how that works.
> 
> Wouldn't it work the same as this?
> 
> @("foo")
> struct S
> {
> 
> }
> 
> void main()
> {
>      import std.stdio;
>      @("bar") S s1;
>      S s2;
>      writeln(__traits(getAttributes, s1));         // bar
>      writeln(__traits(getAttributes, typeof(s1))); // foo
>      writeln(__traits(getAttributes, s2));         // (nothing)
>      writeln(__traits(getAttributes, typeof(s2))); // foo
> }
> 
> -Steve

I don't understand what you mean. Function types _contain_ parameter 
declarations. (Including attributes and default initializers.)


More information about the Digitalmars-d mailing list