2017-02-05 14:34 GMT+01:00 Ryan Joseph <r...@thealchemistguild.com>: > However, the constructor with default params does not work. I get the same > error as before. {$modeswitch advancedrecords} is on. > > type > MyRecord = record > x: integer; > constructor Foo (_x: integer = 0); > end; >
AFAIK this is by design. In theory "constructor Create;" is reserved for record "Initializers" (which means initialization for managed fields of record). Parameter less constructor doesn't have much sense for records. Use "class function Foo: MyRecord ;" instead. Probably syntax "constructor Create;" will be used for record initializers in next Delphi releases (around 2018?). In FPC we have implemented this feature (not merged yet : http://bugs.freepascal.org/view.php?id=30687 ) but as "class operator Initialize(var a: MyRecord);". -- Best regards, Maciej Izak
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal