Struct should be invalid after move

Sebastiaan Koppe mail at skoppe.eu
Tue Nov 27 14:38:39 UTC 2018


On Tuesday, 27 November 2018 at 12:42:43 UTC, Alex wrote:
> On Tuesday, 27 November 2018 at 12:03:20 UTC, Sebastiaan Koppe
>> I have no idea. Logically I would say that - in my case - the 
>> val is invalid.
>>
> This is a source of bugs. The T.init value is the one and only 
> value, which exists, independently from the definition (of 
> Handle). Therefore, your own functions on Handle have to 
> consider this case and have to behave properly. I.e. define 
> some behavior.
>
> I mean, what would happen, if you take an existent function and 
> pass Handle.init to it? Would it assert? Would it yield 42? 
> Some reproducible behavior is defined well enough.

You are right, Handle.init is in the same state as it were after 
a move, so you would expect similar behaviour.


More information about the Digitalmars-d mailing list