“Out” parameters and destructors
Ogion
ogion.art at gmail.com
Tue Mar 18 06:53:29 UTC 2025
On Monday, 17 March 2025 at 11:40:59 UTC, Nick Treleaven wrote:
> See https://github.com/dlang/dmd/issues/18348.
>
> I think the solution is to always call the destructor before
> calling the function. However that was not implemented because
> it would break code that uses `S s = void;`, as `s` might not
> be a destructible value.
Understandable.
I should note that spec never said that the parameter is expected
to be uninitialized. However, the fact that some some code relies
on this behavior can’t be ignored.
I don’t think that “out” parameters worth fixing though. They
only exist because we don’t have first-class tuples. Once we sort
this out, we’ll just deprecate the “out” parameters with all
their warts.
More information about the Digitalmars-d
mailing list