On Mon, 14 Oct 2019 14:02:44 +0200 Sven Barth via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote:
> Mattias Gaertner via fpc-pascal <fpc-pascal@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 _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal