Safe Regions with Deterministic Destruction
ag0aep6g
anonymous at example.com
Tue Oct 27 06:16:11 UTC 2020
On 26.10.20 22:32, Ola Fosheim Grøstad wrote:
> On Monday, 26 October 2020 at 21:10:21 UTC, Per Nordlöw wrote:
>> On Monday, 26 October 2020 at 19:47:57 UTC, Per Nordlöw wrote:
>> Node f() { auto t = Tree(); return t.root; } // shouldn't this
>> error aswell?
>> Node g() { scope t = Tree(); return t.root; } // errors
>
> Node is assumed to be gc allocated, but scope is transitive?
`scope` isn't transitive. It just applies to the pointers in the
variable (i.e. `t.root`).
It doesn't apply to the location of the variable, because the compiler
already knows that references to locals must not escape.
More information about the Digitalmars-d
mailing list