[fpc-pascal] Default record const values

Ryan Joseph ryan at thealchemistguild.com
Sun Nov 11 02:33:33 CET 2018

> On Nov 11, 2018, at 6:51 AM, Ben Grasset <operator97 at gmail.com> wrote:
> Personally I think the answer here is keep working on your new/alternate implementation of default field functionality! It's a missing puzzle piece for FPC generics in many ways.

Not sure how default fields in generics help here. I just thought it would be nice if FPC supported this so we can init records at compile time easier. I’d prefer default struct fields like C++ has but typed const defaults would be an improvement.

I looked at the sources and in ttypedconstbuilder.read_typed_const_data (I think) it simply doesn’t support default record values with typed consts, only the = (a:x;b:x) style syntax. The typed const in the class was clearly defined as a hidden static var but I couldn’t figure out how to assign the values. Maybe I’ll look into it later.

	Ryan Joseph

More information about the fpc-pascal mailing list