3 ms·
I'm not greatly familiar with Rust (and have never written it), and I think I was able to follow. If I'm reading correctly, there are certain traits that object
by mjn 13y ago
I'm not greatly familiar with Rust (and have never written it), and I think I was able to follow. If I'm reading correctly, there are certain traits that objects get automatically if the compiler finds they qualify, which in my mind would be something like Java automatically adding the Serializable interface to classes that it concluded were in fact Serializable, and then removing it when you did something that made it no longer automatically Serializable. The proposal seems to be to make it more like Java: you have to explicitly write "implements Serializable", and it doesn't by default. Then presumably some logic would still apply to ensure that it really can be given the trait you ask for. In particular the move/copy/clone semantics would (under this proposal) no longer be chosen automatically. It seems (again, to someone who hasn't used Rust) like a tradeoff between compilers that make smart choices automatically by default when possible (e.g. about representational strategy), vs. compilers that avoid doing surprising things.
- dbaupp 13y agoThanks for the feedback, it seems like you did follow it correctly > In particular the move/copy/clone semantics would (under this proposal) no longer be chosen automatically (Technically, it's just the move semantics: i.e. if passing a value around by-value (i.e. `a = b` like C, shallow-copying the bytes of the values) makes the compiler consider the source unreadable (a move, non-Pod types) or just duplicates the data, leaving the source still readable (an "implicit copy", Pod types).)