Can't talk too much about CLR, but interop with CLR while having similarities 
syntax wise
is a different interop beast (like JS interop has its specifics).

You can compare CLR and the JVM but not with Java.
Java is a implementation of a language on top of the JVM as Clojure is over 
both 
the JVM and CLR (and JS).

The JVM and CLR (and JS) in this context are engines running language 
implementations, not language implementations by themselves.

Clojure is not Java and vice-versa.  Java objects are values to Clojure.
So is a Boolean object. What you have shown here is a Java specific behaviour,
an ugly patch introduced in Java 5. Even then,

System.out.println(f == Boolean.FALSE); // false 

Can be seen as odd. According to the original poster, I could complain that this
result is non sense in regards to this one:

System.out.println(f == false); // true

Knowing that Boolean.FALSE is the false primitive value and that the Boolean 
object
has its wrapped value set as false. I could complain that they should be equal.

Performance of your suggestion has been measured as posted in this thread, 20x 
slower.

Considering that it's not recommended even by Java implementors to use this 
class 
instead of the primitive type, that it's an alien issue to Clojure and that it 
hampers
performance significantly, it's not worth it.

This case (and this thread) should be dead by now.

Luc

> What is the situation in ClojureCLR?
> 
> And, seeing the if code cited, I just run this code:
> 
> public class BoolTest {
> public static void main(String[] args)
> {
> Boolean f = new Boolean(false);
> System.out.println(f.equals(false)); // true
> System.out.println(f == false); // true
> System.out.println(f == Boolean.FALSE); // false
> System.out.println(f.equals(Boolean.FALSE)); // true
> }
> }
> 
> why not replace
> public Object eval() {
> Object t = testExpr.eval();
> if(t != null && t != Boolean.FALSE)
> return thenExpr.eval();
> return elseExpr.eval();
> }
> 
> by
> public Object eval() {
> Object t = testExpr.eval();
> if(t != null && !t.equals(Boolean.FALSE))
> return thenExpr.eval();
> return elseExpr.eval();
> }
> 
> 
> My guess: performance. But it should be measured
> 
> Angel "Java" Lopez
> http://www.ajlopez.com
> http://twitter.com/ajlopez
> 
> 
> On Sat, Apr 14, 2012 at 6:16 AM, Vinzent <ru.vinz...@gmail.com> wrote:
> 
> > So 'false?' doesn't help you here.
> >>
> > It does, actually (see earlier responses for details)
> >
> >
> >> So if anyone runs into this problem _in real world code_ it's because
> >>
> >> they are calling a Java API that somehow returns a Java Boolean object
> >> embedded in the result. If you are working with a Java data structure
> >> full of _Objects_ then you need to take care of converting those
> >> Object instances into appropriate Clojure values. Calling (boolean v)
> >> is sufficient to convert the Java Object to a Clojure true/false
> >> value.
> >>
> > Yeah it was stated in the very beginning of the thread.
> >
> > --
> > 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
> >
> 
> -- 
> 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