Re: Using attributes inside template instantiation

2014-06-26 Thread Meta via Digitalmars-d-learn
On Thursday, 26 June 2014 at 07:11:03 UTC, Uranuz wrote: But if I write @("hello") struct Hello {} so all of the variables that have type Hello will have attribute @("hello") like come type qualifier because attribute is a part of declaration of Hello. Do I understand correctly? No, it is o

Re: Using attributes inside template instantiation

2014-06-26 Thread Uranuz via Digitalmars-d-learn
But if I write @("hello") struct Hello {} so all of the variables that have type Hello will have attribute @("hello") like come type qualifier because attribute is a part of declaration of Hello. Do I understand correctly?

Re: Using attributes inside template instantiation

2014-06-25 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 17:21:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: The term "attribute" is a bit confusing, especially since "property" is also used in the language to refer to something completely different. A better term is perhaps "annotation". The @foo is an annotation

Re: Using attributes inside template instantiation

2014-06-25 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 25, 2014 at 05:10:06PM +, Chris Nicholson-Sauls via Digitalmars-d-learn wrote: > UDA's are compile-time metadata associated with a specific > declaration. So in something like: > > @foo int x; > > The @foo is attached to x, but is not part of the type. The term "attribute" is a

Re: Using attributes inside template instantiation

2014-06-25 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
UDA's are compile-time metadata associated with a specific declaration. So in something like: @foo int x; The @foo is attached to x, but is not part of the type.

Using attributes inside template instantiation

2014-06-25 Thread Uranuz via Digitalmars-d-learn
I'm trying to declare format for database record in compile time. I consider to use attributes fo this. Can I do something similar to this code? struct RecordFormat(T) {} alias Format = RecordFormat!( @("cool") int ); pragma( msg, Format ); void main() { } Or I want something strang