[fpc-pascal] fcl-passrc errors

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Oct 14 15:39:36 CEST 2019


On Mon, 14 Oct 2019 14:02:44 +0200
Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> Mattias Gaertner via fpc-pascal <fpc-pascal at lists.freepascal.org>
> schrieb am Mo., 14. Okt. 2019, 10:39:
>[...]
> First you agree with me and then you provide in essence the same
> examples as Ryan? So what is it now?

Ryan gave several examples.
I agreed with you in the case of no-typecast:

var
  element: TPasElement;
begin
  for element in module.InterfaceSection.Functions do

You cannot do "element:=module.InterfaceSection.Functions[0]", so it
is consistent that the for-in does not allow it neither.

OTOH if there is a lossless typecast, then it could theoretically be
treated similar to an assign and thus would be consistent - as in: it
is not new concept for a Pascal programmer.

 
> Anyway as I wrote to Ryan: the for-in loop is defined as "for VAR in
> EXPR do", 

True in Delphi.
Not yet in FPC.

>not "for EXPR1 in EXPR2 do".

The assignment operator is *not* defined as Expr1 := Expr2 .

> And even if we would limit it
> to typecasts then the next one would come and ask for this or that to
> be allowed as well.

True, for example properties.

 
> No. Nothing of that. There is a variable in the for-in-loop and
> nothing more. Anything else currently is a bug and *will* break.

Sure. I got the impression that Ryan proposed a consistent extension
and got surprisingly strong rejections.

Mattias


More information about the fpc-pascal mailing list