'when' to denote absense of else-branch is a bad solution to an imaginary problem

As much as if is a nice way to express that there is no side effect.
And all the same arguments can be made for that.

Historically, so many people complained about not seeing else branches that didn’t exist, because of if, that one day Rich Hickey decided to introduce when. Not.

when always served the purpose of implicit do in LISP, and it was even idiomatic to ignore its return value. Intended for side-effects - hence expansion with do in it.

If you really need single branch if, push for if1 in core, a single branch if without do.

1 Like

if does support single branch:

(if true "hello")
;;=> hello

Unfortunately about 70% of vocal Clojure developers don’t support this beauty and would immediately refactor to when so that they can better see that there is no else branch, solving an imaginary problem.

For a person who hates style guidelines you have very strong opinions about how other people should write their code. Why does this issue anger you so much you want to pick a fight in a public forum about it? I don’t know what your intention was here but it comes off as purely antagonistic and counterproductive.

I’ve always found the Clojure community to be very friendly and welcoming, relatively free of the typical gate-keeping and elitism rampant in other niche programming circles. Your comments in this thread come off as aggressive and confrontational, so to anyone stumbling across this in the future: please do not take it as indicative of the general tone of conversation among Clojure programmers. It’s usually much nicer.

6 Likes

Hey folks, we’re going to close this topic. This discussion is not in the spirit of ClojureVerse. We do not welcome posts that are simply polemic. It saps everyone’s energy for no gain.

If you find a need to rage to strangers on the internet about low stake issues like if vs when then please take those needs elsewhere.

7 Likes