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

Walter Bright newshound2 at digitalmars.com
Sun Jul 21 09:34:42 UTC 2019


On 7/19/2019 1:32 AM, Mike Franklin wrote:
> How can the compiler statically determine whether `foo` and `bar` will return a 
> reference to the same data?

It can't.


> It seems the language or type system must provide this guarantee, which would 
> require a full-fledged ownership/borrowing system to accurately enforce what 
> this DIP is proposing.

A full fledged one disallows accessing mutable global state, and now you know 
why :-)

(Because the function signature does not tell the complete story when the 
function accesses mutable global state.)



More information about the Digitalmars-d mailing list