Truly algebraic Variant and Nullable

Paul Backus snarwin at gmail.com
Tue Dec 22 19:45:43 UTC 2020


On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote:
> On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote:
>> On Tuesday, 22 December 2020 at 16:32:20 UTC, 9il wrote:
>>> "Struct non-static methods marked with the return attribute 
>>> ensure the returned reference will not outlive the struct 
>>> instance."
>>
>> The issue isn't that the reference outlives the struct. It's 
>> that the reference outlives a tag change of the tagged union.
>
> If I am correct Dlang doesn't provide an instrument to validate 
> it, isn't it?
>
> What alternative is possible?

The solution sumtype uses is to make opAssign @system if the 
union contains any unsafe types.


More information about the Digitalmars-d-announce mailing list