DIP6: Attributes

Kagamin spam at here.lot
Mon Aug 3 06:58:02 PDT 2009


Don Wrote:

> I agree that there doesn't seem to be a nice way at present. One 
> possibility would be to establish a naming convention for transient 
> fields -- a Ruby-style solution, I guess.
> 
> But are annotations actually an ideal solution for this problem?
> Presumably, you'll have to specify that somewhere else anyway. I mean, 
> during reading it will need to either be initialized separately after 
> serialisation (like opPostBlit, perhaps?), or else remain uninitialized. 
> Serialisation seems to be _extremely_ similar to construction. I'm not 
> sure that annotations capture that.
> 
> D has much more powerful metaprogramming than C# or Java, so my 
> intuition and hope is that we shouldn't need to adopt hacks from those 
> weaker languages. The annotation syntax in C# and Java looks like an 
> ugly hack to me. Purely a subjective opinion, of course, but it seems 
> really out of place in a C-family language.

Here you considered functionality of only one attribute, XmlIgnoreAttribute. XML serialization in .net framework uses 17 attributes. For example you can serialize a field as an XML element or an XML attribute, how do you plan to handle this?



More information about the Digitalmars-d mailing list