[fpc-pascal] Option type

denisgolovan denisgolovan at yandex.ru
Wed Jun 2 03:45:48 CEST 2021



> You simply can't use managed types in a variant clause and as T could be
> a managed type the compiler does not allow it.

Well. I thought it should be precisely the case for variant clause to properly handle.
Compiler knows IsSome field is used to determine if some contains initialized value.

On drop/free it would insert check:
if IsSome then finalize(some);

> Use Nullable.TNullable<T>.

Thanks. It's something close to what I need.

-- Regards,
Denis Golovan


More information about the fpc-pascal mailing list