Re: UDA syntax

2013-01-17 Thread Joseph Cassman
On Thursday, 17 January 2013 at 07:27:35 UTC, Jacob Carlborg wrote: On 2013-01-17 02:59, Joseph Cassman wrote: I was wondering what the syntax is for user defined attributes (i.e. bug 9222) implemented in release 2.061. I was still unclear after reading the thread forum.dlang.org/thread/k7afq6

Re: UDA syntax

2013-01-17 Thread Joseph Cassman
On Thursday, 17 January 2013 at 04:38:14 UTC, Ali Çehreli wrote: On 01/16/2013 05:59 PM, Joseph Cassman wrote: [...] /* This template is not directly related. (I expect it to be in Phobos; maybe * it's already there. (?)) */ template hasAttribute(T, AttributeInQuestion) [...] Ali hasAtt

Re: UDA syntax

2013-01-17 Thread Jacob Carlborg
On 2013-01-17 08:20, Era Scarecrow wrote: 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? You can basically attach an UDA to any declaration. I think the exception is parameters. -- /Jacob Carl

Re: UDA syntax

2013-01-17 Thread mist
UDAs very design point is to never change type they are attached to. If you want to inject code in a class/struct at compile-time, template mixins are supposed tools.

Re: UDA syntax

2013-01-16 Thread Jacob Carlborg
On 2013-01-17 02:59, Joseph Cassman wrote: I was wondering what the syntax is for user defined attributes (i.e. bug 9222) implemented in release 2.061. I was still unclear after reading the thread forum.dlang.org/thread/k7afq6$2832$1...@digitalmars.com. Here's the documentation: http://dlang.o

Re: UDA syntax

2013-01-16 Thread Era Scarecrow
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.

Re: UDA syntax

2013-01-16 Thread Ali Çehreli
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. > Do the structs have to be empty? They can have members. get

Re: UDA syntax

2013-01-16 Thread Era Scarecrow
On Thursday, 17 January 2013 at 04:38:14 UTC, Ali Çehreli wrote: On 01/16/2013 05:59 PM, Joseph Cassman wrote: I was wondering what the syntax is for user defined attributes (I.e. bug 9222) implemented in release 2.061. I was still unclear after reading the thread forum.dlang.org/thread/k7afq6

Re: UDA syntax

2013-01-16 Thread Ali Çehreli
On 01/16/2013 05:59 PM, Joseph Cassman wrote: I was wondering what the syntax is for user defined attributes (i.e. bug 9222) implemented in release 2.061. I was still unclear after reading the thread forum.dlang.org/thread/k7afq6$2832$1...@digitalmars.com. Thanks for the help Joseph The follo

UDA syntax

2013-01-16 Thread Joseph Cassman
I was wondering what the syntax is for user defined attributes (i.e. bug 9222) implemented in release 2.061. I was still unclear after reading the thread forum.dlang.org/thread/k7afq6$2832$1...@digitalmars.com. Thanks for the help Joseph