This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The nature of truth


Per Bothner <per@bothner.com> wrote:
> > because the Java method is returning new Boolean( "false" ) which is not
> > the same object as the "interned" Boolean.FALSE object.
> 
> What happens if it does Boolean.valueOf("false") instead?

The Boolean.valueOf variants all "work fine".  That is, moving from Java
to Scheme requires no extra conversion to get the Scheme "if" form to
work.

> Why is the Java method doing something that silly?

In this lucky case it happens to be our code doing some JDBC transforms
so it's easy enough to change.  The real annoyance is the the Java
Boolean constructors exists at all (this has irritated me for years,
grrr).

> My opinion: "don't do that".

Fair enough ;-). I (and all right thinking people) wouldn't do that.
But because those constructors exist, I can't really expect any third
party code never to call new Boolean( ... ).

Anyway, the docs basically say what to expect:

    The type `boolean' matches any object, and the result is `false' if
    and only if the actual argument is `#f'.

I suggest we extend this and say that #f corresponds to Boolean.FALSE
and #t corresponds to Boolean.TRUE.  We could modify a few procedures to
enforce this correspondence.  I'll submit a patch if you'd like.

Regards,
Chris Dean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]