On 12-06-12 2:53 PM, Niko Matsakis wrote:

1. Write region pointers as *T, not &T, and hence write region patterns
as *P
2. Write unsafe pointers as *unsafe.T (i.e., a special region)
3. Write by-ref bindings as `let (&x, &y) = pair`

Aha. I hadn't seen all these points juxtaposed. It looks .. mostly really good, with one exception: it makes writing C bindings a bit noisy, since they have many unsafe pointers involved. I guess in general a parameter of type *T is implicitly region-variable-qualified so it'll unify with whatever region is supplied, so maybe arg-position is fine; but return-position needs help. Maybe a rule that any pointer returned form an 'extern' function is implicitly in the unsafe region?

(Maybe call it the 'extern' region? hmm)

Anyway, I like this. This is a good target to aim for. Though perhaps .. given that you're saying you _do_ want & in a pattern to "eventually" mean by-ref binding, maybe just make it mean that from the get-go, and defer region-pointer patterns altogether until they can be written unambiguously as *, as you say here. Thoughts?

I also like "by-ref by default" but I don't know a way to combine that
with the ability to write patterns in let. I guess we could just let alt
and let patterns have different defaults.

Yeah .. probably too muddy. I think if we get the above working eventually, along with the implicit-copies warning, it is probably ok.

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to