<div dir="ltr">On 29 May 2013 10:46, Diggory <span dir="ltr"><<a href="mailto:diggsey@googlemail.com" target="_blank">diggsey@googlemail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Tuesday, 28 May 2013 at 13:41:42 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
So I've run into an expression I need to be able to implement std.simd<br>
properly for GDC/LDC.<br>
<br>
Doesn't work:<br>
  @attribute("target", T) void func(string T)(...);<br>
<br>
In this case, currently, the UDA can't receive the template arg that was<br>
given to the function.<br>
<br>
I require that attributes on templates be able to make use of the template<br>
args, since the template arg given may affect the attribute in some<br>
circumstances.<br>
</blockquote>
<br></div>
Can you not move the template outside the attribute like this?:<br>
<br>
template func(string T) {<br>
    @attribute("target", T) void func(...);<br>
}<br>
</blockquote></div><br></div><div class="gmail_extra" style>Yes, that's Kenji's initial suggestion, which I can use for now, but it feels like a workaround.</div><div class="gmail_extra" style>It feels pretty lame to have to wrap select functions in an arbitrary outer scope, and it also has some subtle implications; how does auto-complete/intellisense see it? As a template, or as whatever it resolves to?</div>
<div class="gmail_extra" style>The latter would imply some pretty powerful semantic analysis, and if there's static logic inside the template? The IDE basically won't work properly for any of these functions.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Either way, the attribute certainly looks like it's part of the declaration, I think any reasoning programmer would assume that it is. It's only a DMD implementation detail that says otherwise, and it's not particularly intuitive to a programmer.</div>
</div>