RFC: DIP draft for "Compiler-defined Attribute Consistency"

vit vit at vit.vit
Fri Jul 16 10:17:39 UTC 2021

On Friday, 16 July 2021 at 09:06:26 UTC, Alexandru Ermicioi wrote:
> On Wednesday, 14 July 2021 at 15:01:05 UTC, Rune Morling wrote:
>> Hi All,
>> ...
>> Comments very welcome.
> What about making those attributes not just prefixed with @, 
> but fully fledged UDA?
> From the point of view of compile time code this would remove 
> the necessity in strange syntax for is expression to get them. 
> You'd just fetch them as any other uda.
> Also this will allow us to extend these attributes with fields!
> Say for example: @safe(disabled.yes)
> Older compiler would just ignore this, but newer could take 
> hints and other additional info defined on these udas for 
> better optimization, or improved checks, or just for 
> informational purposes.
> Another example: @deprecated("See xxx for this functionality")
> Best regards,
> Alexandru.

And make attributes symbols:

template Pure(bool con){
	import std.meta : AliasSeq;

	static if(con)
		alias Pure = pure;     //this is not valid
		alias Pure = AliasSeq!();	

//conditional atributes:

void foo()@(Pure!true){   //expand to `pure`


void bar()@(Pure!false){   //expand to `()`



More information about the Digitalmars-d mailing list