On Borrow Checking
Dukc
ajieskola at gmail.com
Fri May 16 11:29:22 UTC 2025
On Friday, 16 May 2025 at 11:20:40 UTC, Dukc wrote:
> Under the current scope checking rules, `result` is going to be
> inferred as `scope`, because a scope argument
> (`&localInts[enumVal1]`) is assigned to a `return scope`
> parameter. Therefore, assigning it to a static variable
> wouldn't compile with scope checking on.
I wrote this wrong due to editing the code example after writing
this paragraph. Should be:
Under the current scope checking rules, the return value of `fun`
is going to be inferred as `scope`, because a limited lifetime
value (`&localInts[enumVal1]`) is assigned to it's `return
scope` parameter. Therefore, assigning it to a static variable
wouldn't compile with scope checking on.
More information about the Digitalmars-d
mailing list