←back to thread

128 points RGBCube | 1 comments | | HN request time: 0.263s | source
Show context
csomar ◴[] No.44497997[source]
Derive Clone is not broken. It is basic. I’d say this is a good area for a dependency but not the core Rust functionality. Keep derive simple and stupid, so people can learn they can derive stuff themselves. It also avoids any surprises.
replies(3): >>44498105 #>>44498162 #>>44498173 #
josephg ◴[] No.44498105[source]
I disagree. I think the current behaviour is surprising. The first time I ran into this problem, I spent half an hour trying to figure out what was wrong with my code - before eventually realising its a known problem in the language. What a waste of time.

The language & compiler should be unsurprising. If you have language feature A, and language feature B, if you combine them you should get A+B in the most obvious way. There shouldn't be weird extra constraints & gotchas that you trip over.

replies(3): >>44498184 #>>44498204 #>>44498538 #
1. Ar-Curunir ◴[] No.44498538[source]
The solution is to use a derive macro like derivative or educe.