[Lazarus] Should the "at" word be painted as reserved word ?

Sven Barth pascaldragon at googlemail.com
Wed Feb 15 13:37:52 CET 2012


Am 15.02.2012 12:12, schrieb Hans-Peter Diettrich:
> Marco van de Voort schrieb:
>> On Mon, Feb 13, 2012 at 10:25:34AM +0800, Paul Ishenin wrote:
>>>> According to my "Sprachgef??hl" this cannot be anything other than a
>>>> reserved word. Its not an identifier, its not an operator, it can only
>>>> be a reserved word.
>>> At is not a reserved word. It works only in the context of a raise
>>> statement.
>>
>> How is this different from "until" ?
>
> Borland made a distinction between *reserved* words and *directives*.
> Reserved words cannot be used as identifiers, while directives are
> recognized as something special only in their related context, and can
> be used as identifiers in all other places. If you ever happened to
> write a break() or exit() procedure, you'll have noticed that your
> remaining code may fail with very strange errors, because these take
> precedence over the language-defined behaviour of "break" or "exit".

"exit" and "break" are different. They are compiler intrinsics, so they 
are basically functions/procedures. "at" (or "read" in the context of 
properties) is not an intrinsic, but a token.

To take this problem up to eleven: The following code compiles in FPC 
(and AFAIK Delphi as well):

type
   Message = record
     ID: LongWord;
   end;

   TSomeClass = class
     procedure Message(var Message: Message); message 23;
   end;

Here only the "message" in front of the "23" is a "keyword" (or better 
"directive").

Regards,
Sven





More information about the Lazarus mailing list