On 4/23/13 7:51 AM, Alexander Stavonin wrote:
Second response not about deep copy but about simplifying deep copy
operation. Actually, I understood the reason of deep-copy-only
conversions immediately after sending the question. And "big source code
overhead from nothing" means: we almost always have to write conversion
manually rather than do it automatically.
You can use flatpipes to automatically send data containing `@` smart
pointers from task to task, if that's what you're looking for. (You may
have to tag the structs involved with `#[auto_encode]` and
`#[auto_decode]` though.)
The proposal is adding auto
conversion operation between Shared and Owned boxes. May be it should
looks like C++ copy or move constructors. In case of move conversion,
the operation can be allowed only if there is only one Shared box is
owned a value.
This doesn't work if `@` is garbage collected. You'd have to trace the
entire heap.
For copy conversion it can make deep object copy
automatically.
But you can already do this.
struct Pizza {
...
}
let managed_pizza = @Pizza { ... };
let owned_pizza = ~*managed_pizza;
It only goes one level deep, but doing more than that wouldn't work in
the type system; you can't have structures that are parameterized over
the type of smart pointers they contain for various reasons.
Patrick
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev