Well, changing the behaviour of 'if' is not the only way to fix the problem 
(and it's impossible because of backward compatibility anyway). In my mind, 
more realistic solution would be:
>
>  1. Clearly state in the section on interop that clojure, unlike java, 
doesn't treat 'false' and (Boolean. false) as equal objects.
2. Clearly state in the doc of '=' that it should not be used for testing 
equality of booleans, since it could lead to confusing results.
3. Emphasis that 'true?' and 'false?' should be used instead of (= x false).

Then typical expierence of the newcomer can be changed from

=> (def x (Boolean. false))
#'x
=> (if x :t :f)
:t      ; WTF?!
=> (= (Boolean. false) false)
true ; WHAT...???
** going to ask a question on the google group

to

=> (def x (Boolean. false))
#'x
=> (if x :t :f)
:t      ; WTF?!
=> (= (Boolean. false) false)
WARNING: false? should be used instead, see also: http://...
=> (false? x)
false ; hmmm...
=> (if (boolean x) :t :f)
:f       ; ok, it's not very convenient, but they probably have a reason 
for that. I  can live with it.
** continues to write his program

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to