On 11/29/11 6:18 PM, Graydon Hoare wrote:
It's *very bad* in the case of copy: copies are made all over the place and the world where copy-does-not-mean-copy is a familiar C++ nightmare I do not want to recreate. Copy constructors, move constructors, conversion operators and assignment operators. Please no. If someone wants to invoke custom code, make them write custom_code() or custom.code(). At least.
I have two objections to this:
First, I don't think copies should be going on all over the place, to start, and certainly not implicitly. If I had any concern about Rust as it stands today, it's that we implicitly copy left and right. If state is immutable, it's harmless but inefficient. If state is mutable, it's changing the semantics of the program in *very* subtle and non-obvious ways.
Second, unless copies can be user-defined, the built-in semantics are just not always suitable. Imagine a user-defined hashtable, for example. If I write "copy map" where map is an instance of this hashtable, I want it to be a *deep copy*. I do not want to be sharing the bucket lists and so forth.
Niko
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
