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


Chris Dean wrote:
Per Bothner <per@bothner.com> wrote:
Chris Dean wrote:
because the Java method is returning new Boolean( "false" ) which is not
the same object as the "interned" Boolean.FALSE object.
...
Why is the Java method doing something that silly?
...
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( ... ).

I concur that Kawa's treatment of java.lang.Boolean is (pretty much **) the correct interpretation for Scheme - there is only "one true #f".


The only problem is in going from general Java code which returns java.lang.Boolean (or perhaps even more generally, java.lang.Object). I don't have any problem putting the onus on the Java code (or the Scheme application wrapper) to convert that result properly.

Note that this is not a problem for Boolean objects, not the boolean primitives. Which does segue into where Kawa might do something slightly different.

**

Kawa is slightly inconsistent with #f:

(define-namespace bool "class:java.lang.Boolean")
(define fake-false (bool:new #f))
#f
(not #f)
fake-false
(not fake-false)
(bool:booleanValue fake-false)
(not (bool:booleanValue fake-false))

The issue being that non #f objects print as #f.

So while I don't think Kawa should necessarily call booleanValue on Boolean objects (aside from wasted overhead, it doesn't address Object), I wonder whether objects which are not eq? to #f should print as #f.

If they got toStringed, you'ld get:

(bool:toString fake-false)
false

Also perhaps only j.l.B.TRUE and j.l.B.FALSE should be boolean? So (boolean? fake-false) would change from #t to #f (at which point it would be a "regular" object and print as "false").

Jim
--
"I love deadlines. I love the whooshing sound they make as they fly by." -- Douglas Adams



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