enum Format

zjh fqbqrr at 163.com
Fri Jan 12 07:38:38 UTC 2024


On Friday, 12 January 2024 at 07:31:49 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> Let's try something different.
>

> ```d
> func(@metadata("hi!") 2);
>
> void func(T)(T arg) {
> 	enum MetaData = __traits(getAttributes, arg);
> 	pragma(msg, MetaData);
> }
> ```
>



I think D language can create an `attribute dictionary` for any 
building block

In this way, the `attribute soup` can be simplified. It would be 
even better to simplify the method of `getting and setting` 
attributes. It can be used to facilitate the extraction of 
`metadata`


More information about the Digitalmars-d mailing list