Truly algebraic Variant and Nullable

ag0aep6g anonymous at example.com
Tue Dec 22 16:43:30 UTC 2020


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.

> The docs maybe not clear enough. `trustedGet` asserts type is 
> matched, while `get` throws an exception if the type doesn't 
> match.

You can't rely on an assert for @safe (unless it's 
`assert(false);`).


More information about the Digitalmars-d-announce mailing list