https://issues.dlang.org/show_bug.cgi?id=17440
--- Comment #2 from Vladimir Panteleev <[email protected]> --- (In reply to Marenz from comment #0) > I am not sure if it is desired, but it was highly unintuitive and unexpected > for me: > > If you use Nullable with a class type and call .nullify(), all members of > the class are set to the uninitialized state. Example: That is almost certainly not intended, and (as RazvanN wrote) is because the Nullable implementation makes no attempt to do anything different when used with a class. What happens is that it calls object.destroy on the class, which instead of setting the class reference to null, it clobbers the class data. However, I think your example is also incorrect, because it accesses the value of a nullified object. Is there any particular reason you need to use Nullify with a class type instead of simply using the class type directly and use "null" to indicate the unset state? --
