Alexander-
What are you suggesting would be the semantics for a Shared -> Owned
conversion?
Just think about it in the the abstract for a moment: If X and Y are
both sharing a reference to a @Pizza, and X decides it wants to hand
the pizza to a customer who is expecting a ~Pizza, what is X supposed
to do? Block until Y relinquishes its hold on the pizza? To my mind,
X has no choice but to cook another pizza that looks just like the one
it is shared with Y.
(Now, Owned -> Shared conversion might actually make sense in the
abstract; at that point I think we'd just be encountering
implementation artifacts of the Rust language, rather than fundamental
obstacles?)
Cheers,
-Felix
On Tue Apr 23 15:36:25 2013, Alexander Stavonin wrote:
Hi all, I'm really confused. What's about Shared 2 Owned conversions?
This one looks ugly, nevertheless works:
let a = @5;
let b = *a;
let c = ~b;
io::println(fmt!("%?, %?, %?", a, b, c));
> @5, 5, ~5
But what about arrays?
let a = @[5];
let b = *a;
let c = ~b;
> error: type @[<VI0>] cannot be dereferenced
Is it true, that there is no any way for converting between different
boxes types without deep copying of objects?! I'm shocked %)
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
--
irc: pnkfelix on irc.mozilla.org
email: {fklock, pnkfelix}@mozilla.org
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev