See my comments below

> 
> >
> > So, what does all this mean?
> >
> > 1. This is not a Clojure behavior but a Java one. Somehow millions of Java 
> > developers and projects
> > managed to get by with this weird behavior.
> >
> I am not sure what you mean here:
> 
>         Boolean b = new Boolean(false);
>         if (b) System.out.println("true");
>         else System.out.println("false");
> 
> This code will print "false". So the Java behaviour is fine. The Oracle 
> comment is a mere efficiency issue, not a semantic issue.

Hence the remark that this is a Java specific behavior. The Java compiler does 
the job
for the programmer under the hood by casting the Boolean object to a primitive 
type.
It has nothing to do with Clojure. In Java 1.4 you would have to call 
booleanValue
explicitly, it is only from Java 5 that the compiler is casting to a primitive 
type
by itself.

> 
>  
> 
> > 2. This fact is documented and there are alternatives.
> >
> In my case the problem crept in in a very unexpected way (if you care to 
> read the thread, which you didnt, I think). And this is just the problem 
> with the Clojure semantics of Booleans. Not being able to rely on a basic 
> if branch is very very very bad.

Again a Java Boolean object has no relation with Clojure. In Clojure anything 
nil
or false (the Clojure value false, nothing to do with the Java Boolean class)
is false. Anything else is true. Java classes have nothing to do with
Clojure, Clojure is not an OOP language like Java.


>  
> 
> > 3. You can get very far with just true and false literals, especially in 
> > pure Clojure programs.
> >
> Again, that's just what I did, and I was hit by the problem anyway. Its 
> funny the way people are susceptible to brain washing.
>  

No, you used the Boolean object Java class, not the semantic used in
Clojure to express false or true values.

You are mixing Clojure and Java and you are not able yet to differentiate
specific behaviours of these two worlds.

Clojure has nothing to do with Java, Clojure is implemented on the JVM and
happens to allow you calling Java. No more.

There is a JavaScript Clojure implementation, a .Net implementation even a 
python
one is on the way and the language semantic is very similar over all
implementations albeit the underlying supporting engines are different.
They all allow some interop with the internal engine they run on but when you 
cross
that frontier you are not in the Clojure semantic anymore.

If Clojure was only a Java extension, there would be no other implentations,
it would be restricted to the JVM.

Luc

> 
> > MK
> >
> >
> 
> -- 
> 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
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail!

-- 
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