custom attribute proposal (yeah, another one)
Steven Schveighoffer
schveiguy at yahoo.com
Fri Apr 6 06:44:21 PDT 2012
On Fri, 06 Apr 2012 09:23:01 -0400, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> 7. One can lookup whether an attribute exists on a symbol using
> __traits(hasAttribute, symbol).
> 8. One can retrieve the value of the CTFE result using
> __traits(getAttribute, symbol). If the CTFE function returns void, this
> is a compiler error.
Boy, this was underspecified!
__traits(hasAttribute, attribute, symbol)
__traits(getAttribute, attribute, symbol)
> string serialize(T)(const ref T t) if (__traits(hasAttribute,
> serializable) && __traits(getAttribute, serializable))
again:
if (__traits(hasAttribute, serializable, T) && __traits(getAttribute,
serializable, T))
-Steve
More information about the Digitalmars-d
mailing list