←back to thread

128 points RGBCube | 1 comments | | HN request time: 0s | source
Show context
loa_in_ ◴[] No.44497772[source]
Automatically deriving Clone is a convenience. You can and should write your own implementation for Clone whenever you need it and automatically derived implementation is insufficient.
replies(3): >>44498124 #>>44499705 #>>44500307 #
josephg ◴[] No.44498124[source]
But this issue makes it confusing & surprising when an automatically derived clone is sufficient and when its not. Its a silly extra rule that you have to memorise.

By the way, this issue also affects all of the other derivable traits in std - including PartialEq, Debug and others. Manually deriving all this stuff - especially Debug - is needless pain. Especially as your structs change and you need to (or forget to) maintain all this stuff.

Elegant software is measured in the number of lines of code you didn't need to write.

replies(4): >>44498182 #>>44498258 #>>44498373 #>>44498385 #
j-pb ◴[] No.44498373[source]
I disagree; Elegant software is explicit. Tbh I wouldn't mind if we got rid of derives tomorrow. Given the ability of LLMs to generate and maintain all that boilerplate for you, I don't see a reason for having "barely enough smarts" heuristic solutions to this.

I rather have a simple and explicit language with a bit more typing, than a perl that tries to include 10.000 convenience hacks.

(Something like Uiua is ok too, but their tacitness comes from simplicity not convenience.)

Debug is a great example for this. Is derived debug convenient? Sure. Does it produce good error messages? No. How could it? Only you know what fields are important and how they should be presented. (maybe convert the binary fields to hex, or display the bitset as a bit matrix)

We're leaving so much elegance and beauty in software engineering on the table, just because we're lazy.

replies(2): >>44498536 #>>44500053 #
zwnow ◴[] No.44498536[source]
I am sorry but Uiua and LLM generated code? This has to be a shitpost
replies(2): >>44498734 #>>44500555 #
1. j-pb ◴[] No.44500555[source]
I never said to use LLMs to generate Uiua. I said that Uiua is an edge case where tacitness is indeed elegance.

I wouldn't write anything but Rust via LLMs, because that's the only language where I feel that the static type checking story is strong enough, in large parts thanks to kani.