[fpc-devel] fpc modifiers

Joerg Schuelke joerg.schuelke at gmx.de
Thu Apr 28 17:48:12 CEST 2011


First i will note that what i state is not an error or bug in free
pascal, but it is somehow unclean implemented.
The decision for modifiers like cvar or cdecl to be an <identifier>
token or an <modifier> token relies on context information. But what is
that context? An example:

type
  name=procedure;
  cdecl=integer;

results in an error, but

type
  cdecl=integer;
  name=procedure;

is correct.

The procedure type declaration consumes the <cdecl> token regardless of
the following token.
There is no need for this. The <=> token can be used as context switch,
but you´ll need a look ahead of 2 tokens. And that conflicts with the
LL1 base structure of pascal. What a pity.

For some other modifiers you have the same situation

var
  name:typ;
  cvar:integer;

is an error, but

var
  cvar:integer;
  name:typ;

is correct.
You may say in most circumstances the required <;> token right before
the modifier token is the problem.

For example for the <absolute> directive this kind of problem does not
arise.

The forward directive is another example, would´nt it be better to
have forward be an keyword?

I think if the compiler allows one construct he should not reject the
other. But, i am not the first programmer who complains about that, so
put it in the garbage. (Or start discussion)

Sorry for my bad English,
with best regards

	Jörg Schülke



More information about the fpc-devel mailing list