DIP 1021--Argument Ownership and Function Calls--Community Review Round 1

Nick Treleaven nick at geany.org
Thu Jul 25 12:03:19 UTC 2019


On Friday, 19 July 2019 at 22:36:40 UTC, Olivier FAURE wrote:
>     byte* identity(ref return byte b) @safe {
>         return &b;
>     }

When I saw this (last week), I was surprised it compiled, but it 
does (with -dip1000). The returned pointer is scope, but that has 
a different lifetime from ref returns, which only last for the 
line that called the function.

I don't think `return &b` should compile (but even with that 
change, this DIP doesn't make exposing heap memory as ref work 
with @safe).


More information about the Digitalmars-d mailing list