Attributes on Enum Members: Call for use cases.
Steven Schveighoffer
schveiguy at yahoo.com
Wed Nov 29 16:58:53 UTC 2017
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
More information about the Digitalmars-d
mailing list