<div class="gmail_quote">On 18 March 2012 05:04, Kapps <span dir="ltr"><<a href="mailto:opantm2%2Bspam@gmail.com">opantm2+spam@gmail.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="HOEnZb"><div class="h5">On Sunday, 18 March 2012 at 01:48:07 UTC, Walter Bright wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 3/17/2012 6:39 PM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm sure C# already answers all these questions. It has precisely the same set<br>
of issues associated.<br>
</blockquote>
<br>
C# doesn't have RAII, immutable, nor the notion of threadlocal/shared types.<br>
</blockquote>
<br></div></div>
It has threadlocal using the [ThreadLocal] attribute which gets implemented by the compiler.<br>
<br>
In C#, all attributes live inside the TypeInfo/MethodInfo/etc for the class/struct/method/field/<u></u>parameter. I don't see this being a problem. I can't think of good use cases where an attribute/annotation should be per-instance at all, particularly with the compile-time power that D has, whereas C# does not have any. Honestly, most uses of attributes in D would be done at compile-time, and I think that's acceptable until/if runtime reflection is put in. If it is needed, it can live inside TypeInfo/MethodInfo, but is (imo) absolutely not needed on a per-instance basis. This is the job of fields or interfaces.<br>

</blockquote></div><br><div>I think that's a fair call. I wonder why Java feels the need for stateful attributes.</div><div>I have made extensive use of java attributes that have been stateful. Java's persistence api's rely on stateful attributes a lot, but I think that can be done in other ways in D.</div>
<div><br></div><div>Compile-time attributes sound like a great start, it's much simpler. But they do need to be able to 'do stuff', ie, add some property/method to a field (using the field its self as the context pointer), not just simply 'tag' it.</div>