DIP 1021--Argument Ownership and Function Calls--Community Review Round 1
Paul Backus
snarwin at gmail.com
Mon Jul 15 15:55:46 UTC 2019
On Monday, 15 July 2019 at 15:23:32 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community
> Review for DIP 1021, "Argument Ownership and Function Calls":
>
> https://github.com/dlang/DIPs/blob/793f83911fdc8c88c6ef34e6a36b5e11e3e574e5/DIPs/DIP1021.md
Do these new checks also handle the case where one of the
references is passed implicitly to a delegate or nested function
via their context? In other words, if we re-write the example
from the DIP to use a nested function, like so:
struct S {
byte* ptr;
ref byte get() { return *ptr; }
}
void test() {
S s;
s.ptr = cast(byte*) malloc(1);
void foo(ref byte b) {
free(s.ptr);
b = 4;
}
foo(s.ptr);
}
Will the call to `foo` here be correctly flagged as taking
multiple mutable references to `s`?
More information about the Digitalmars-d
mailing list