3 ms·
It begs the question, why is clone a method and borrowing implicit? Perhaps it should be the opposite. `.borrow` or something like that.
by philosopher1234 4y ago
It begs the question, why is clone a method and borrowing implicit? Perhaps it should be the opposite. `.borrow` or something like that.
- colejohnson66 4y agoTechnically, it's not implicit; You need to prefix your value with `&` to borrow it.
- steveklabnik 4y agoBorrowing isn't implicit, as you have an &. But even beyond that, clone is not implicit because it may be an expensive operation, and so Rust wants to expose that to you. It avoids issues like this: https://news.ycombinator.com/item?id=8704318 https://news.ycombinator.com/item?id=8704318
- TheCycoONE 4y agoThe Copy trait is for cases where it's cheap enough to be implicit. Otherwise the philosophy of the designers was that things that may be expensive should be explicit.