Borrowing and Ownership

Atila Neves atila.neves at gmail.com
Wed Nov 13 08:08:29 UTC 2019


On Sunday, 27 October 2019 at 22:36:30 UTC, Timon Gehr wrote:
> I finally got around to writing up some thoughts on @safe 
> borrowing and ownership in D.

Thanks! I'd been wanting to understand your thoughts on this for 
a while. A few questions:

> ref implies scope

Is that true now??

> `scope` should apply to all types of data equally

And how would the application of `scope` to, say, `int` affect 
it? What would the compiler do with that?

> Non-immutable non-scope values may not be assigned to `scope` 
> values
> A non-`scope` pointer cannot be dereferenced if that would 
> yield a `scope` value
> `scope` has to be a type constructor.

Could you please expand on the rationale for these rules?

Other than that, I wonder about the teachability of these rules. 
I had to read the proposal several times myself.



More information about the Digitalmars-d mailing list