Comment by _verandaguy
4 hours ago
> So .clone() significantly reduces the mental overhead of using rust with a small performance impact? I'm intrigued :)
No, the performance impact will depend on `impl Clone` for the underlying type, the hotness of the code path, and how sensitive to those two variables your code's domain is. It may be extremely expensive.
> Maybe it's harder to reason about the lifetime semantics while also writing code, and works better as a second phase (the de-cloning).
There are cases where assuming `clone` is possible allows for significant architectural and API simplifications at the expense of performance. In those cases, de-cloning will be involved and may produce significant changes.
No comments yet
Contribute on Hacker News ↗