This is a very good thread about why “deep cloning” is essentially an intractable problem. But it focuses on some low level details. There is a higher level explanation: 1/https://twitter.com/Keithamus/status/1018052501214584832 …
-
-
Also, not every type is Cloneable. If a type doesn't opt in to being Cloneable, all types that contain it aren't. Maybe that's the lynchpin?
-
This sounds like a key point. If the dev of a type hasn’t explicitly provide cloning support, its instances can’t be cloned. By default app specific types aren’t clonable. Unfortunately people ask for a universal deepClone generally expect it to work everywhere, by default.
-
Makes sense. Making it easy to derive makes it likely that people support it in Rust if the trivial implementation works, but I can see why trying to make it work by default isn't a good idea.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.