Returning a reference to be manipulated
Dennis
dkorpel at gmail.com
Sat Apr 15 14:25:36 UTC 2023
On Saturday, 15 April 2023 at 14:10:57 UTC, Dennis wrote:
> This adds complexity, just to add some 'intermediate' safety
> between `@system` and `@safe` in a few cases. It's better to
> keep the rules simple and consistent.
To quote my past self:
> There used to be different rules for lifetime errors in all of
> these:
> - explicit `@system` functions
> - `@system` by default functions (yes, [they were
> special](https://issues.dlang.org/show_bug.cgi?id=19873))
> - inferred functions
> - `@safe` functions
> - `@trusted` functions
>
> It was really complex and confusing, and I've worked on
> simplifying it such that all lifetime errors are safety
> violations like any other. The only exception is directly
> returning a dangling pointer to a stack variable, which is just
> an error even in @system code ([issue
> 19873](https://issues.dlang.org/show_bug.cgi?id=19873)). I
> don't want to go back to more special cases, especially with
> the dip1000 by default transition which is complex enough as is.
https://forum.dlang.org/post/nzotevvzvbpqscfxsuod@forum.dlang.org
More information about the Digitalmars-d-learn
mailing list