News for hackers. Stuff that matters.
Re:Haskell vs. Ada vs. C++ vs. an Experiment in Software Pro... by kccqzy on Wednesday December 18, 2024 @02:29PM (#42453976)
That's not an anti-feature because of cleverness. It's a failure of engineering. Just like everything else, clever code needs to be encapsulated behind a good interface, be well documented, be well tested.

> if you randomly come across it most developers won't be able to easily understand how it works

So document it.

> uses undefined behavior

So fix the undefined behavior. Use memcpy or bit_cast.

> gives a suboptimal result

That's probably intentionally sacrificing accuracy for speed. Document it.

> doesn't have any meaningful comments

Then add it.

Clever algorithms is never the problem by itself. It's undocumented unencapsulated clever algorithms with unknown bugs.

Re:Haskell vs. Ada vs. C++ vs. an Experiment in Software Pro... by dwattttt on Wednesday December 18, 2024 @06:43PM (#42456761)
Maybe the best example of this would be memcpy. It's extremely clear what it does, but the implementations would surely be "clever" code. And yet you don't need to know anything about SSE to use it.