Variable Naming Issue (Conflicts?)

Casey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 22 12:35:33 PDT 2014


Hello,

I'm working on some code where I'm trying to generate structs 
that map to JSON documents via a mixin.  That part works except 
when specific variable gets created.  Below is the error that I'm 
getting:

     source/objects.d-mixin-70(75): Error: no identifier for 
declarator string
     source/objects.d-mixin-70(75): Error: found '=' when 
expecting '('
     source/objects.d-mixin-70(75): Error: basic type expected, 
not ""
     source/objects.d-mixin-70(75): Error: found '""' when 
expecting ')'

If I prefix all of the generated variables with an underscore, it 
works fine.  It looks like the variable "delete" is the issue.  
To me, it looks like it's expecting some sort of "delete" method.

Now, I'm planning on leveraging vibe.d's JSON serialization to 
convert an object to/from JSON, so the variable names have to 
match the names they have in the JSON document.

My question is, is there a way I can prevent this conflict from 
occurring without affecting what the struct will look like?


More information about the Digitalmars-d-learn mailing list