[fpc-pascal] IsValidIdent() and identifiers escaped with &

Michael Van Canneyt michael at freepascal.org
Mon Feb 6 04:16:00 CET 2017



On Sun, 5 Feb 2017, Jürgen Hestermann wrote:

> Am 2017-02-05 um 20:26 schrieb Sven Barth:
>> 
>> > Is that a valid identifier?
>> > Here
>> > http://wiki.lazarus.freepascal.org/Identifiers
>> > it says:
>> > Rules for identifiers:
>> > Must begin with a letter from the English alphabet or an underscore (_).
>> > Can be followed by alphanumeric characters (alphabetic characters and 
>> numerals), or the underscore (_).
>> > May not contain special characters, such as:
>> >
>> >  ~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? , . / | \
>> 
>> http://freepascal.org/docs-html/current/ref/refse4.html#x16-150001.4
>> 
>
> Strange!
> Why was it added to use reserved words as an identifier?
> What is the use of that?

For example:

If you import a SOAP webservice or REST API, often reserved words are used 
in the names of arguments or properties. 
This trick allows to use them as-is in the pascal proxy classes.

Michael.


More information about the fpc-pascal mailing list