I want delete or change class's member name on compile-time
    Steven Schveighoffer 
    schveiguy at yahoo.com
       
    Fri Jun  8 18:55:29 UTC 2018
    
    
  
On 6/8/18 2:13 PM, Brian wrote:
> Like:
> 
> class A
> {
>      string b;
>      string c;
> }
> 
> compile-time to:
> 
> class A
> {
>      string _b;
>      string c;
> }
> 
> or:
> 
> class A
> {
>      string c;
> }
> 
Not possible in D. What you are looking for is an AST macro, and D does 
not have those.
However, you can potentially create another type that mimics everything 
that A does except for one thing using compile-time introspection. But 
you won't be able to do that with the member functions.
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list