Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: