[fpc-pascal] Uniform initialization?

Ryan Joseph ryan at thealchemistguild.com
Sun Nov 11 16:16:42 CET 2018

> On Nov 11, 2018, at 10:03 PM, tobiasgiesen at gmail.com wrote:
> Hello,
> Delphi 10.3 is going to support inline variable declarations like this:
> begin
>  var i : Integer := 22;
>  WriteLn(i);
>  end;
> I would assume it can also be used with records. For details, please see
> http://blog.marcocantu.com/blog/2018-october-inline-variables-delphi.html
> So maybe that's the route to go.

That’s interesting Delphi is breaking with the one of the oldest Pascal traditions. I have no idea what implications that would have for FPC or if it will be supported. If I recall this idea was shunned pretty thoroughly on the list a few months ago.

It’s still not a replacement for implicit constructors though since it’s tied to declaration time. Swift has implicit constructors for structs but uses the normal constructor syntax, unlike c++ which uses a special {} syntax. It really cuts down on boiler plate stuff when making new records. It’s a no-brainer for me and super easy to implement (already got most of it done today before I thought to ask) but lets see what people have to say.

Anonymous functions are still my biggest wish for FPC but they are considerably more complicated than what I can do currently.  

	Ryan Joseph

More information about the fpc-pascal mailing list