June 04, 2017
On Sunday, 4 June 2017 at 09:04:14 UTC, Jonathan M Davis wrote:
> [...]

Why Nullable!T call destroy for reference types?
June 04, 2017
On Sunday, June 04, 2017 09:31:24 vit via Digitalmars-d-learn wrote:
> On Sunday, 4 June 2017 at 09:04:14 UTC, Jonathan M Davis wrote:
> > [...]
>
> Why Nullable!T call destroy for reference types?

It calls destroy for everything. Why it does that instead of simply assigning T.init and setting _isNull to true, I don't know. Maybe the commit history would say, but unless it was done as part of a bugfix, it's more likely that you'd have to use the commit history to figure out who made it do that and ask them. Thinking about it though, it does seem like it's probably the wrong behavior. I'd guess that it was done with structs in mind, and it doesn't usually make sense to put a class reference in Nullable outside of generic code, since they can be null on their own.

- Jonathan M Davis

June 05, 2017
On Sunday, 4 June 2017 at 08:51:44 UTC, Jonathan M Davis wrote:
>> On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
>> > Assigning Nullable!Test.init is equivalent to setting the internal value to Test.init and setting _isNull to false.
>>
> T _value;
> bool _isNull = true;

So it was a typo that Nullable.init sets _isNull to false?
June 05, 2017
On Monday, June 05, 2017 10:46:39 Kagamin via Digitalmars-d-learn wrote:
> On Sunday, 4 June 2017 at 08:51:44 UTC, Jonathan M Davis wrote:
> >> On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis
> >>
> >> wrote:
> >> > Assigning Nullable!Test.init is equivalent to setting the internal value to Test.init and setting _isNull to false.
> >
> > T _value;
> > bool _isNull = true;
>
> So it was a typo that Nullable.init sets _isNull to false?

Yes.

- Jonathan M Davis

1 2
Next ›   Last »