Re:Rust 1.17
by Lev1a on Thursday April 27, 2017 @02:17PM
(#14213622)
If I understand the ownership rules correctly, it would actually violate those rules to have the "familiar syntax". Also it seems to be Rust's thing to make things explicit, e.g. `.clone()`, not having `++`-style operators etc.
[ Parent
| on HN ]
Re:Rust 1.17
by steveklabnik on Thursday April 27, 2017 @02:18PM
(#14213634)
In this case, due to the rules, it would be possible; the call to clone would be inside the method call, so you wouldn't see it. (With other signatures it may not, but Add returns a value, not a reference.)
In other words, it would violate the conventions, but not the rules.
(Okay so there's a _really_ obscure rule here that sill prevents this but it only matters because it's the standard library. It's not actually the signature)