Why `case`? You can make the same with a plain record: type generic TOption<T> = record IsSome: boolean; some: T; end;
вт, 1 июн. 2021 г. в 21:26, denisgolovan via fpc-pascal < fpc-pascal@lists.freepascal.org>: > Hi all > > I am trying to implement Option<T> type in FPC. > > type > generic TOption<T> = record > case IsSome:boolean of > true: ( some: T ); > false: (); > end; > > However fpc just emits errors: > Error: Type parameters may require initialization/finalization - cannot be > used in variant records > > Could anybody suggest some sane workaround for the problem? > > -- Regards, > Denis Golovan > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > -- Victor Matuzenko (Виктор Матузенко)
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal