On Fri, 31 May 2013 06:47:07 -0400, Timon Gehr <timon.g...@gmx.ch> wrote:

@attribute("target", T) void func(string T)() {}

would simply need to be treated like:

template func(string T){
     @attribute("target", T) void func() {}
}

In fact, today's current semantics suggest this is exactly what happens:

import std.stdio;

@("a") void func(T)(T t) {}

void main()
{
    writefln("func attributes: %s", [__traits(getAttributes, func)]);
writefln("func!int attributes: %s", [__traits(getAttributes, func!int)]);
}

Output:

func attributes: []
func!int attributes: ["a"]

If the attributes applied only to the template symbol, then you would think func would have the attribute a.

Plus, the idea that you must actually instantiate the template to get an attribute to apply REALLY suggests the attribute should be aware of the template parameters.

-Steve

Reply via email to