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

Reply via email to