Proposal: user defined attributes
Kapps
opantm2+spam at gmail.com
Sat Mar 17 20:04:49 PDT 2012
On Sunday, 18 March 2012 at 01:48:07 UTC, Walter Bright wrote:
> On 3/17/2012 6:39 PM, Manu wrote:
>> I'm sure C# already answers all these questions. It has
>> precisely the same set
>> of issues associated.
>
> C# doesn't have RAII, immutable, nor the notion of
> threadlocal/shared types.
It has threadlocal using the [ThreadLocal] attribute which gets
implemented by the compiler.
In C#, all attributes live inside the TypeInfo/MethodInfo/etc for
the class/struct/method/field/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.
More information about the Digitalmars-d
mailing list