[fpc-pascal] Option type

denisgolovan denisgolovan at yandex.ru
Tue Jun 1 20:20:26 CEST 2021


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


More information about the fpc-pascal mailing list