Closed andreaferretti closed 6 years ago
Yeah I was thinking that it might be good idea to generate pure enums from the start because the language supports that. I was lazy so didn't do it yet but I'll definitely get it done at some point.
Thanks for reminding! :-)
I wanted to try this, but the latest version of the generator does not compile for me, either on devel or on 0.18:
descriptor_pb.nim(344, 21) template/generic instantiation from here
gen.nim(431, 44) Error: type mismatch: got <Tag>
but expected one of:
proc wiretype(field: NimNode): WireType
proc wiretype(ft: FieldType): WireType
It seems that I forgot to push some changes that I made yesterday. I'll push them later today.
Should work now.
Confirmed, thank you!
The enums generated by the generator are not pure. This creates a problem if a value of the enum is named the same as the name of the enum, except for casing. The simplest example is
If you run the generator on this, you get the following nim file
This file will not compile because the name of the enum (
Foo
) conflicts with one of the values of the enum itself (FOO
). It would be nice to have the possibility to generate pure enums, so that the valueFOO
would need to be scoped asFoo.FOO
and no conflict would arise