On 11/19/2013 10:51 AM, Gaetan wrote:
In the french presentation for rust 0.8 [1], the author gives the analogy
with C++ semantics
- ~ is a bit like unique_ptr
- @ is an enhanced shared_ptr<T>
- borrowed pointer works like C++ reference
and I think it was very helpful to better understand them. I don't know if
it is true or now, but this comparison helps a lot understanding the
concepts.You can present them like this, and after, add more precision, and
difference with the C++ counter parts.
A tutorial to make would be "Rust for C++ programmer" :)
[1] http://linuxfr.org/news/presentation-de-rust-0-8
This helped me too, even if I'm not a C++ programmer (can only read). However,
it is still not enough to understand the meaning of each of those pointer
varieties, imo (at least, _i_ still don't get it). What semantic kinds of
pointed data should go to each variety? why? I would help at once improving the
tutorial if I did understand.
@Daniel: I would answer your questions if I did understand the *logic* of Rust's
pointers and memory management. The tutorial, in my view, should precisely help
on this. Instead, it tells us about machine-side issues without meaning (which
are important and we need to know, but don't help in understanding). What is the
semantic counter-part of all this? Why does it exist?
The logic here is hidden or difficult. As a comparison, we don't need tons of
explanations to understand the differences between a sequential collection
(array, list) and, say, a set. The logic is nearly obvious, we easily get why
both kinds exist. And in fact, the machine-side, implementation counterpart,
while important, comes after, once we understand the meaning; then we get to
know the price one has to pay for quick, direct access of given items, as
opposed to access by index.
Denis
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev