[fpc-pascal] deprecated syntax is inconsistent.

Michael Van Canneyt michael at freepascal.org
Thu Apr 29 11:44:05 CEST 2010



On Thu, 29 Apr 2010, Graeme Geldenhuys wrote:

> Jonas Maebe het geskryf:
>>
>> Conversely, adding it before the semicolon in case of procedure/
>> function declarations would be inconsistent with how other modifiers
>> have always been used there.
>
> I don't have problems with it's usage in procedures, functions or methods.
> The modifier appearing after the semicolon seems like the correct syntax,
> and that is how 'virtual', 'override' etc is used. This I think is correct
> and should stay as is.
>
>
> The issue I do have is using deprecated in a type declaration, where it
> appears *before* the semicolon. This just doesn't look or feel right. It
> affects variable, class and record declarations. This is what I was talking
> about and think should be fixed in objfpc mode and inconsistent usage
> limited to only delphi mode.

Jonas tried to explain that this is not possible.

Consider the following - what  you propose - statements:

Var
   A : Integer;
   deprecated : Boolean;

The compiler cannot decide whether the 'deprecated' is a modifier or the
name of a variable. Both are possible (deprecated is NOT a keyword) and
valid.

With the current syntax:

Var
   A : Integer deprecated;
   Deprecated : Boolean;

The compiler knows in both cases what is meant.

The matter could be resolved by making 'deprecated' and all other modifiers
into keywords, but that would be a major backwards incompatibility.


Michael.



More information about the fpc-pascal mailing list