Search code examples
syntaxboo

How to escape identifiers in Boo?


If I have an identifier with a same name as existing keyword, how do I escape it?


Solution

  • That's what I found (and this is probably the final answer):

    1. It is possible to use @ as a prefix in identifier names. However, by default it creates a different identifier (@a != a).
    2. Since @ is allowed, it is possible to add a new compiler step to the pipeline that will do TrimStart('@') on all identifiers. It works ok, you will just have to remember all types of things that have names.
    3. If you are using Rhino.DSL, it has a UseSymbols step that converts @a into 'a', which had confused me a lot (I was working with project that included this step by default).