This is the mail archive of the 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]

Re: some questions using callbacks to java

"Paul R. Potts" <> 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).
	--Per Bothner

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