<p dir="ltr">You can put the attribute on the function. <br>
There are a couple of go libraries that use struct tags in a similar way. Such as <a href="http://code.google.com/p/gorest">code.google.com/p/gorest</a><br>
</p>
<div class="gmail_quote">On 6 Nov 2012 15:15, "Adam D. Ruppe" <<a href="mailto:destructionator@gmail.com">destructionator@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tuesday, 6 November 2012 at 07:55:51 UTC, Walter Bright wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
User Defined Attributes (UDA) are compile time expressions that can be attached to a declaration.<br>
</blockquote>
<br>
Hmmm, it didn't work on the most important place for my use case, function parameters:<br>
<br>
void a(["test"] int foo) {<br>
    pragma(msg, __traits(getAttributes, foo));<br>
}<br>
<br>
test.d(1): Error: basic type expected, not [<br>
test.d(1): Error: found 'int' when expecting ')'<br>
test.d(1): Error: semicolon expected following function declaration<br>
test.d(1): Error: no identifier for declarator foo<br>
test.d(1): Error: semicolon expected, not ')'<br>
test.d(1): Error: Declaration expected, not ')'<br>
<br>
<br>
<br>
The reason why this is important to me is I have a nice automatic form builder given a function signature. I'd like to add things like hints about the params that my existing code can take a look at.<br>
<br>
<br>
(a problem that might remain is being able to reference the parameters outside... I use a ParameterTypeTuple and .stringof right now but that probably won't work for getAttributes. But we can always solve that later.)<br>

</blockquote></div>