custom attribute proposal (yeah, another one)

Jacob Carlborg doob at me.com
Sat Apr 7 09:57:03 PDT 2012


On 2012-04-07 16:30, Piotr Szturmaj wrote:
> Jacob Carlborg wrote:
>> On 2012-04-07 00:40, Piotr Szturmaj wrote:
>>
>>> Ok, but it needs more work in the compiler, comparing to identifier
>>> search and remembering expression tuple of a symbol. Also, I just found
>>> a major drawback of this approach: consider parameterless attributes
>>> like @NotNull. What would you return from function named NotNull()?
>>
>> void ?
>
> I know that's the answer, but how would you store void, and get it from
> __traits(getAttributes) ?

The compiler would only store that the attribute is attached to the 
declaration. In this case only "hasAttribute" is of interest.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list