This is the mail archive of the
mailing list for the Kawa project.
Re: some questions using callbacks to java
- To: "Paul R. Potts" <potts at umich dot edu>
- Subject: Re: some questions using callbacks to java
- From: Per Bothner <per at bothner dot com>
- Date: 03 Aug 2000 00:16:50 -0700
- Cc: <brlewis at alum dot mit dot edu>, <kawa at sourceware dot cygnus dot com>, Mike Nowak <mnowak at umich dot edu>
- References: <B5AE72B1.19CC6email@example.com>
"Paul R. Potts" <firstname.lastname@example.org> writes:
> (invoke debug-callbacks 'print Gender)
> ** the result is Male
Have you verified that (string-length Gender) is 4?
It is possible it may contain non-printing characters (spaces or nuls).
In Scheme, (equal? "Male" "Male ") returns #f.
> (invoke parameter-callbacks 'bind 'PT_ID)
> (invoke debug-callbacks 'print PT_ID)
> *** prints 1
> (invoke debug-callbacks 'print (equal? PT_ID "1"))
Well, since PR_ID is a java.lang.String, it is the same as '1, which
is not equal? to "1".
> So the question is, how can we make this work? We're comparing FStrings to
> Kawa strings, which doesn't work
That should work, if your're using equal? (It probably won't work
if you compare using eq?.)
> and we're comparing Java strings to Kawa strings and that doesn't work.
It is not supposed to.
> We've also tried to pass string.intern() to
> put() but I thought intern() wasn't necessary anymore
It depends on the context. Many Java libarary routines return
non-interned strings. However, Environment compares names using ==,
which means they need to be interned (unless you deliberately want them
to be different).