[Issue 17440] Nullable.nullify() resets referenced object
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 6 05:58:08 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17440
--- Comment #6 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Marenz from comment #5)
> Closing? Well.. It is _very_ unexpected that Nullable would just follow a
> reference and kills everything. It's like you add a pointer to an array and
> after setting it to null your pointed object is also reset.
>
> While this is not a terrible problem to work around, it is quite
> inconsistent and surprising behavior and I think this should really be fixed.
>
> Do you really want to have such behavior in the std lib?
Nullable wasn't design for reference types. I guess that a check could be added
to reject creating Nullable's from data structures that are not value types.
--
More information about the Digitalmars-d-bugs
mailing list