[fpc-pascal] [fpc-devel] Nested function closures

Tomas Hajny XHajT03 at hajny.biz
Thu Apr 29 10:49:42 CEST 2021


On 2021-04-29 09:00, Mattias Gaertner via fpc-pascal wrote:
> On Thu, 29 Apr 2021 07:52:19 +0200
> Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
>> [...]
>> You completely ignored my first point, which in this case is the much
>> more significant one: Pascal does not support type inference.
> 
> FPC does not.
> Delphi does:
> http://docwiki.embarcadero.com/RADStudio/Sydney/en/Inline_Variable_Declaration
> 
> begin
>   var MyDictionary := TDictionary<string, Integer>.Create;
>   for var I:=1 to 10 do ;
> end.

Are you aware that Delphi limits this specifically to inline variable 
declaration (quoting including the typo: "compiler can now in several 
circumstances infer the type of a variable at ints line declaration 
location")? One could argue to which extent are inline variable 
declarations still Pascal... :/ (I have my opinion about this, but let's 
save everybody from a flamewar about this topic.)

Tomas


More information about the fpc-pascal mailing list