Armando~

Libraries that target JRE 1.2 compatibility, will not call
`Boolean.valueOf(var)` internally.  Instead they will call `new
Boolean(var)`.  If they return those results to modern java code, it will
unbox correctly into either true or false and thus work as expected in
constructs of the form:

if (old_library_call()) {
   // handle true
} else {
  // handle false
}

If clojure's `if` form does not correctly unbox Booleans in the same manner,
then that really should be viewed as a bug in Clojure.  As these libraries
are not likely to change to using the newer `Boolean.valueOf()` since that
break compatibility.  Yes, they could create their own static factory for
Booleans and call that instead, but I don't think consumers of the library
are going to want to figure out (the hard way) that they need to hack their
library to use it from Clojure.

Matt

On Wed, Aug 18, 2010 at 4:07 PM, Armando Blancas
<armando_blan...@yahoo.com>wrote:

> I don't see what the concern may be. Can you elaborate?
>
> On Aug 18, 10:04 am, Matt Fowles <matt.fow...@gmail.com> wrote:
> > All~
> >
> > Boolean.valueOf() was added in 1.4.  While that seems ancient, some older
> > libraries use 'new Boolean()' because they maintain 1.2 compatibility.
>  It
> > seems like Clojure should take more care when it unboxes Booleans...
> >
> > Matt
> >
> > On Wed, Aug 18, 2010 at 12:57 PM, Nicolas Oury <nicolas.o...@gmail.com
> >wrote:
> >
> >
> >
> > > I am not an expert. Is it possible on some JDK to put a breakpoint on
> > > Boolean constructor and look at the stack?
> > > Or you can't put a breakpoint on standard library?
> >
> > > --
> > > 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<clojure%2bunsubscr...@googlegroups.com>
> <clojure%2bunsubscr...@googlegroups.com<clojure%252bunsubscr...@googlegroups.com>
> ­>
> > > For more options, visit this group at
> > >http://groups.google.com/group/clojure?hl=en- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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<clojure%2bunsubscr...@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