views:

282

answers:

2

I need to Escape a reserved word to use it as an identifier in Delphi. I thought that was accomplished by using the ampersand "&", but that doesn't seem to be working right. Any other suggestions?

+3  A: 

I found the doc page (search for Extended Syntax) on it, and it should be ampersand.

Figured out the problem. The ampersand works for compiling and error insight, but not code completion. Good to know. I had to add an _ suffix to get code completion to work, then change it back afterwords. I should check QC for a bug report.

Jim McKeeth
Another way to refer to identifiers that are reserved words is to use their fully qualified names — include the unit or variable name before the function or property name.
Rob Kennedy
A: 

So you want to write something like

var string : Integer;

function begin: double;

I don't have an answer to your question, but could you please explain why would you want to do that?

Aldo
code generation perhaps
Jimmy
I am doing something totally crazy that problem only makes sense because I am strung out on jet lag and a developer conference high. Check out www.Delphi.org and you will see it in all the details in a week (hopefully).
Jim McKeeth
+1 for asking what the heck I am thinking. Someone needs to check on me from time to time.
Jim McKeeth
-1 "I don't have an answer" Then post a comment, please, and not an answer. One reason for wanting to use reserved words as identifiers is when interfacing with .Net code written in other languages, where Delphi's reserved words aren't reserved at all.
Rob Kennedy