On Thursday, 17 January 2013 at 06:55:57 UTC, Ali Çehreli wrote:
On 01/16/2013 09:45 PM, Era Scarecrow wrote:

(Do they have to be structs?) If they don't and you add code, can that code help/add or modify the attributed object (or can it at all?).

It looks like some mixin magic can be used.

 Hmm a good example would help.

Do the structs have to be empty?

They can have members. getAttributes preserves the types and values of the attributes. It returns a tuple.

With the warning that I don't have any experience with attributes, the following program uses an attribute type that has a member to indicate the number of times that a variable must be serialized. (Stupid idea. :))

Actually it does show quite a bit of how to make it useful (even if it's in a silly way); But it isn't adding anything to S directly and only during compile-time does it have any promise of use; Which is enough by itself if need be.

Having arguments you can put into the struct does mean it can be useful in other ways, including perhaps having methods where it can do calculations for you on the side since it's CTFE.

I suppose next we need a section that describes how to convert one piece of code to use UDA's, the thought process behind it and how it's more useful that way.

Oh yes, do UDA's only work on types? or do they work on functions/methods/delegates too? If you have it on a function how could that be useful?

I get the feeling the UDA will be a good topic at DConf, and an article to be added to dlang.

Reply via email to