[fpc-pascal] fpc procedure modifier []

Michael Van Canneyt michael at freepascal.org
Thu Nov 16 15:21:06 CET 2017

On Thu, 16 Nov 2017, Mattias Gaertner wrote:

> On Thu, 16 Nov 2017 14:12:18 +0100
> Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>> [...]
>> So, how will FPC distinguish the two []?
>> The only idea I have is to check whether the first identifier is a
>> attribute and if not handle it as a modifier (or if a comma is following
>> the first identifier).
> pparser can't do that.
> And I fear that this heuristic will lead to confusing error messages. I
> hope there is a better way.
> Delphi does not support it. It thinks it is an undefined attribute. So
> IMO FPC's [] modifier should be disabled in mode delphi+delphiunicode.
> So the problem will only happen in mode objfpc or when the user
> enable the modeswitch prefixedattributes.

I think that prefixedattributes should simply disable the use of proc
modifier []. The probability of having code that needs both is almost zero,
the [] syntax is very old and almost not used.

Mode Delphi(Unicode) enables prefixedattributes, all other modes need an
explicit modeswitch to enable it.

Let's keep it clear, simple and unambiguous.


More information about the fpc-pascal mailing list