> On Apr 28, 2017, at 12:21 PM, LacaK <la...@zoznam.sk> wrote:
> 
> you can workaround this by using typed constant for instance. Something like:
> 
> const
>  DEFAULT_REC: TMyRec = (x: 0; y: 0; z: 0 );
> var
>  rec: TMyRec;
> begin
>  rec := DEFAULT_REC; // or rec := Default(TMyRec) if you want zeroes
>  ...
> 
> L.

Run time is the problem though. If the compiler knows how to define a record 
using that syntax you should be able to do

rec := (x: a; y: b; z: c);

instead of mucking around with constructors which do basically the same thing 
but with boiler plate code. The syntax for a default constructor already exists 
in the language but it’s not implemented outside of type declarations for some 
reason.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to