DIP 1012--Attributes--Preliminary Review Round 1

vit via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 28 01:15:32 PDT 2017


On Friday, 28 July 2017 at 07:50:43 UTC, Daniel N wrote:
> On Thursday, 27 July 2017 at 14:44:23 UTC, Mike Parker wrote:
>> DIP 1012 is titled "Attributes".
>>
>> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1012.md
>>
>> All review-related feedback on and discussion of the DIP 
>> should occur in this thread. The review period will end at 
>> 11:59 PM ET on August 10 (3:59 AM GMT August 11), or when I 
>> make a post declaring it complete.
>>
>> At the end of Round 1, if further review is deemed necessary, 
>> the DIP will be scheduled for another round. Otherwise, it 
>> will be queued for the formal review and evaluation by the 
>> language authors.
>>
>> Thanks in advance to all who participate.
>>
>> Destroy!
>
> I was hoping an attribute overhaul would go in a different 
> direction.
> 1) Remove all negation
> 2) Add an true/false yes/no parameter etc.
>
> @gc!no:
>   ...
> @gc!yes:
>   ...

Or:


//Create symbol to attribute (new kind of symbol)
__attribute Pure = pure;

alias PureIf(bool X : true) = Pure;
alias PureIf(bool X : false) = AliasSeq!();


//expand UDA PureIf to pure if IsPure == true
void test(bool IsPure)()@PureIf!IsPure{
}

//can be in std.attrib or similar module:
__attribute Safe = @safe;
__attribute Nothrow = nothrow;

alias As = AliasSeq!(Pure, Nothrow, Safe);

//expand to pure nothrow @safe
void test2()@As{		

}


More information about the Digitalmars-d mailing list