On Sun, Jul 28, 2013 at 4:54 PM, Brian Anderson <[email protected]> wrote: > On 07/28/2013 01:17 PM, Gábor Lehel wrote: >> >> On Sun, Jul 28, 2013 at 7:42 PM, Daniel Micay <[email protected]> >> wrote: >>> >>> On Sun, Jul 28, 2013 at 12:50 PM, Patrick Walton <[email protected]> >>> wrote: >>>> >>>> I'm as sympathetic as anybody to want to reduce the number of pointer >>>> types >>>> in the language, as it's folks' #1 complaint about Rust. But I think >>>> this >>>> one is probably a necessary evil. >>>> >>>> >>>> Patrick >>> >>> We can reduce the number of pointer types in the language by >>> describing the language with semantic terms rather than implementation >>> details of the compiler. The safe subset of Rust lacks pointers in the >>> same way that a language like Ruby lacks them. >>> >>> For example, `~[T]` is described as a unique vector, despite being a >>> pointer. It feels like we're going out of our way to make the language >>> complex when we use a term like "borrowed pointer" instead of just >>> calling it a reference like Java. >>> >>> The documentation would be so much simpler if it just referred to >>> references and unique/managed boxes. Rust only has two types that are >>> semantically pointers, `*` and `*mut`. > > > FWIW I prefer the terms box and reference. I don't really understand the > idea that only * is 'semantically a pointer' though.
Unique boxes can be implemented without a pointer as long as the type is no larger than the slot needed to contain a pointer-size object. The pointer itself just isn't part of the type's contract, since there's no pointer arithmetic. Type-based alias analysis will prevent treating anything but raw pointers as plain old addresses you can mutate whenever you want or cast to any type. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
