How to escape identifiers in Boo?
Question
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):
- It is possible to use
@
as a prefix in identifier names. However, by default it creates a different identifier (@a != a
). - Since
@
is allowed, it is possible to add a new compiler step to the pipeline that will doTrimStart('@')
on all identifiers. It works ok, you will just have to remember all types of things that have names. - 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).
OTHER TIPS
I don't think anything like the C# @ prefix is implemented in Boo... but I'm pretty sure it could be achieved by inserting a custom compiler step to the beginning of the compiler pipeline.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow