3 ms·
Reminds me of an early code review that preferred applying De Morgan’s law and being initially surprised. It was a small chat that started talks of the clever v
by del_operator 7y ago
Reminds me of an early code review that preferred applying De Morgan’s law and being initially surprised. It was a small chat that started talks of the clever vs readability on a small team.
Similar things would happen with say map(f) |> map(g) vs map(f |> g). My clev-dar just reminds me to ping the reviewer or leave a note.
- revvx 7y agoYeah. I always see the De Morgan's Law being used to make the code look prettier or look less complicated. I'd say it's objectively prettier most of the time, but unfortunately that's exactly what introduces double negatives or other ambiguous stuff and makes the code more confusing. It's a nice refactoring step, though: apply it, extract the condition into a well-named variable and test that condition.