[fpc-pascal] Default record const values

Ryan Joseph ryan at thealchemistguild.com
Mon Nov 12 02:20:56 CET 2018

> On Nov 12, 2018, at 8:08 AM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
> But this syntax worked if you assigned it within blocks. Why does it need to be removed? Since I discovered it I was planning on using it instead of class functions with default values which require an implementation and are much longer to write.

Here’s an example of what I was doing before. A constant is so much better and doesn’t require the implementation and we still get the same . syntax, i.e., TPoint.Up. 

Instead of removing it maybe give the error unless it’s the last field of the record and in which case can assumed to be fully defined.

  TPoint = record
    x: TFloat;
    y: TFloat;
    class function Up (_x: TFloat = 0; _y: TFloat = -1): TPoint; static; inline;

	Ryan Joseph

More information about the fpc-pascal mailing list