Attributes on Enum Members: Call for use cases.
Timon Gehr
timon.gehr at gmx.ch
Wed Nov 29 21:46:51 UTC 2017
On 29.11.2017 20:49, Steven Schveighoffer wrote:
> On 11/29/17 2:01 PM, Timon Gehr wrote:
>
> OK, now I get what you are saying. In the same vein, I tested applying
> attributes to functions themselves:
>
> @("a") int fun() { return 0; }
> pragma(msg, typeof(&fun)); // int function()
>
> @("b") int gun() { return 1; }
> pragma(msg, typeof(&gun)); // int function()
>
> void main()
> {
> auto f = &fun;
> f = &gun; // works
> }
>
> Given that, it seems attributes play no part in the type itself, they
> are just metadata in the compiler.
Well, I think the case of UDAs on parameters is closer to:
struct S{
@("a") int x1;
@("b") int x2;
}
The attributes on x1 and x2 are indeed part of the type S, even if the
attributes on S itself are not.
If we go with "UDAs on parameters are not part of the function type",
how to you get the UDAs of the parameters of some function?
More information about the Digitalmars-d
mailing list