Real beginner traits question
    rikki cattermole 
    rikki at cattermole.co.nz
       
    Mon Sep 25 05:40:06 UTC 2017
    
    
  
On 25/09/2017 6:28 AM, WhatMeForget wrote:
> 
> This is taken exactly from the traits documentation.
> 
> ------------------------------------------------
> 
> 25 Traits
> 
> 25.21 identifier
> 
> Takes one argument, a symbol. Returns the identifier for that symbol as 
> a string literal.
> 
> ------------------------------------------------
> 
> 
> There are no examples. My naive brain keeps thinking that a symbol and 
> an identifier are the same things.  Can someone give me good definitions 
> of "symbol" and "identifier".   And maybe an example if it is not too 
> much trouble.
```D
void main() {}
pragma(msg, __traits(identifier, main));
pragma(msg, __traits(identifier, Foo));
pragma(msg, __traits(identifier, Foo.func));
struct Foo {
	void func();	
}
```
```
main
Foo
func
```
    
    
More information about the Digitalmars-d-learn
mailing list