On 11-07-14 12:59 PM, Marijn Haverbeke wrote:
Disallows ... on the *caller* side as well?

Of course -- otherwise it would be unsafe.you could call a function
that gave you an alias to the internals of a local, and then trash
that local and keep on using the alias.

Yeah. That's sorta my concern: seems like most examples I can think of (hashtable access, say?) woul be returning aliases to types that are likely to collide with other locals, with under type-based rules, and since the callee is opaque there might not be much else to go on.

But I guess that's just my hand-waving imagination, not a real argument. Might as well try and see if any interesting cases are legal, if you're interested :)

How far out can the alias go?

I guess you mean returning through multiple functions? My current
proposed scheme would only allow that if each of the intermediate
functions (returning an alias, but not creating it themselves) could
pinpoint the root of the alias precisely (either because the
alias-returning functions they call take only one alias argument, or
because of type-based analysis) and this pinpointed root is an alias
parameter to the function. I expect this'll be workable.

Ok. Certainly not opposed if you can formalize it enough to convince yourself it's safe.

-Graydon

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to