This is the mail archive of the kawa@sourceware.org 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: Interaktion between Scheme and Java


On 2/22/06, Per Bothner <per@bothner.com> wrote:
>
> The best you can do is compile with --debug-print-expr (or
> --debug-print-final-expr) which prints out a dump of the
> internal Expression tree.  That is mainly for debugging and/or
> understanding the compiler.

Thanks for that. I think i slowly get the point Kawa is all about.
It's a little bit hard, because it behaves different from other Java
APIs. :)


But there is some other problem I didnt master yet. A while ago[1]
Shoeb wrote the following to the list.

> I have a list of Java objects in a Java list (e.g. java.util.ArrayList).
>
> I have a scheme function that takes a Scheme list as a parameter.
>
> How do I pass my Java list to the scheme function?
>
> (In my scheme function I want to treat the list as a Scheme list so that I
> can invoke 'car' and 'cdr' on it.)
>
> I tried creating a new Pair() object in my Java code, adding my Java objects
> to it (using the 'add' method since Pair implements the List interface), and
> passing it as an argument to the scheme function. I get the following
> exception:
>
>    'java.lang.UnsupportedOperationException: gnu.lists.Pair does not
> implement addPos
>

I tried the same but got the following Exception.

Exception in thread "main" java.lang.ExceptionInInitializerError
	at de.bakera.kawa.SchemeTest.firstOne(SchemeTest.scm:9)
	at Test.main(Test.java:32)
Caused by: java.lang.NullPointerException
	at gnu.mapping.InheritingEnvironment.lookupInherited(InheritingEnvironment.java:72)
	at gnu.mapping.InheritingEnvironment.getLocation(InheritingEnvironment.java:100)
	at gnu.mapping.Environment.getLocation(Environment.java:117)
	at gnu.expr.ModuleInfo.find(ModuleInfo.java:100)
	at gnu.expr.ModuleInfo.register(ModuleInfo.java:115)
	at kawa.lib.lists.<init>(lists.scm)
	at kawa.lib.lists.<clinit>(lists.scm)
	... 2 more


To figure out the problem i attached the java and the scheme sources
to this mail. Perhaps somebody has an idea how to solve this. I don't
know how to provide a list created in java to the kawa-compiled
classes that were generated from scheme sources.


Many thanks for any help. :)


[1]http://sourceware.org/ml/kawa/2003-q3/msg00121.html

--
,----[ /X\arco -- www.bakera.de ]----
|         (Y F) = (F (Y F))
`----[ www.bulb-publications.de ]----

Attachment: SchemeTest.scm
Description: Binary data

Attachment: Test.java
Description: Binary data


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