Truly algebraic Variant and Nullable

9il ilyayaroshenko at gmail.com
Wed Dec 23 03:16:53 UTC 2020


On Tuesday, 22 December 2020 at 19:45:43 UTC, Paul Backus wrote:
> 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.

That is interesting, I have missed it. Thanks


More information about the Digitalmars-d-announce mailing list