[fpc-devel] "Default" discussion for SmartPointers etc

Maciej Izak hnb.code at gmail.com
Thu Jul 28 18:09:14 CEST 2016


2016-07-28 17:58 GMT+02:00 Michael Van Canneyt <michael at freepascal.org>:

> Then you will not have this problem; GetValue will always return a
> 'Default' value.


IMO bad design. You can't use value of not assigned nilable types as same
as you can't use not assigned pointers >.<.

There is no magic in ^ . Just look at declaration:

Instance: ^T default;

you can create alternative nilable struct with:

FInstance: T default;
FHasValue: Boolean;

with that you don't need any ^ operator

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160728/880cfc3f/attachment.html>


More information about the fpc-devel mailing list