bbatsov/clojure-style-guide

suggestion: prefer `boolean` over returning literal `true` and `false`

achengs opened this issue · 1 comments

Either the author needs to get a literal boolean ...

Before:
(if (some-expression here) true false)

After:
(boolean (some-expression here))

Or the author could make do with a truthy value:

After:
(some-expression here)

(There are already tips in the style guide pointing out when-not and other primitives, so it would seem on par to suggest boolean as well. Hat tip to Sean Corfield -- I didn't know about boolean before he pointed it out.)

Yep, that'd be a good addition to the "Idioms" section.