dplassgit / d2lang

D2 is a strongly-typed, statically-typed, (mostly) inferred-type compiled language.
MIT License
7 stars 0 forks source link

Allow symbols with a leading underscore _ #321

Open dplassgit opened 8 months ago

dplassgit commented 8 months ago

There's really no good reason to reject them.

When translating user-created symbols (proc names, globals) into memory storage, the code generators can prepend an underscore.

For internal-only symbols (e.g., internal labels), the code generator(s) can prepend D_. This way, internal symbols will never start with an underscore and external ones will always. If the user prepends their own underscore, the compiler will just prepend another one.

This is also needed for external procs that start with an underscore (!).