Optional tags and attributes
Jacob Carlborg
doob at me.com
Sat Jan 18 02:23:29 PST 2014
On 2014-01-18 04:02, Steven Schveighoffer wrote:
> I think a "use the attributes of X" would be a general enough tool.
>
> Something like:
>
> void thisIsSoPolymorphic() attrOf(T.foo)
Yet another case for AST macros:
class Careful (T)
{
void thisIsSoPolymporphic () @inferAttributes(T.foo) { }
}
macro inferAttributes (Context context, Ast!(Symbol) symbol, Declaration
decl)
{
foreach (attr ; symbol.attributes)
decl.attributes ~= attr;
return decl;
}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list