Hi rust-dev,

On Github, PCWalton said (https://github.com/mozilla/rust/issues/3222#issuecomment-8306828): > The reason why |@str| cannot be dereferenced is that |str| is dynamically sized. If we allowed strings to be copied to the stack like ints can, then we'd have to add dynamic allocas and that would break the segmented stacks model. Other than that, |@int| and |@str| are intended to be conceptually very similar.

How about having str be represented internally - but not in the type system - as a pointer to the actual string data. Copying a str would copy the pointed-to string data in addition to the pointer, so str would not be implicitly copyable.

The advantage of such an arrangement is that str would be fixed size and ~str/@str/&str would be consistent with other types.

Is this actually a reasonable system?

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

Reply via email to