<div class="gmail_quote">On 6 April 2012 13:28, Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com">newshound2@digitalmars.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 4/6/2012 3:23 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What about:<br>
<br>
struct editor<br>
{<br>
this(string name, EditType, Colour = Colour.Default, string description = null)<br>
{<br>
//...<br>
}<br>
<br>
blah blah blah<br>
}<br>
<br>
@attr(editor("thing",...blah..<u></u>.))<br>
</blockquote>
<br></div>
Are you really changing the arguments for every declaration? Or is it one set that is repeated everywhere?<br></blockquote><div><br></div><div>Of course, what's the point otherwise? This is the very definition of annotation.</div>
<div>Everything needs to be exposed in the editor differently.</div><div><br></div><div>The power of attributes are that they are tightly syntactically bound to the items they attribute. Nobody can change any class/struct without having the syntax force them to make any necessary corrections to their attributes too.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't see the advantage over:<br>
@editor(...)<br>
<br>
?<br>
</blockquote>
<br>
Name collisions with other @ attributes.<br></blockquote><div><br></div><div>If they were declared as normal structs, they would follow normal namespace rules.</div><div><br></div><div>@company.lib.MyAttribute(...) should also be a valid expression.</div>
<div><br></div><div>The only collisions are @trusted, @safe... I think programmers can handle a few reserved keywords.</div><div>I already can't go and name a variable whatever I want for the same reason: int private = 10;</div>
</div>