DIP 1021--Argument Ownership and Function Calls--Community Review Round 1
David Bennett
davidbennett at bravevision.com
Fri Jul 19 02:59:59 UTC 2019
On Friday, 19 July 2019 at 01:32:34 UTC, Walter Bright wrote:
>
> One example is all that's necessary. Adding a bunch of
> irrelevant code to it adds nothing.
>
> What part of the proposal are you not understanding?
>
For me it's unclear if the examples as given would become compile
time errors because it states "The checks would only be enforced
for @safe code." and the examples are not @safe.
Would the examples give errors in @system code or are they just
there to illustrate buggy code and the idea being these could be
made @safe with future work? (or both?)
Also, does it also check simple non-heap references, for example
would this become compile time error?
---
@safe void f(scope ref int a, scope ref int b)
{
a=1;
assert(b==1);
}
@safe void main()
{
int i = 0;
f(i, i);
assert(i==1);
}
---
Horrible code, but it compiles and runs with -dip1000 -dip25
currently. https://run.dlang.io/is/XdQBzJ
If it's going to be an error, a simple example like this in the
Breaking Changes and Deprecations section could help clear up
whats changing from a practical sense.
More information about the Digitalmars-d
mailing list