public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* R7RS Libraries and Java interaction
@ 2017-03-22 20:55 Peter Lane
  2017-03-22 21:15 ` Per Bothner
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Lane @ 2017-03-22 20:55 UTC (permalink / raw)
  To: kawa

Hi,

Is it possible to make an R7RS library recognise Java interaction when 
compiled?

e.g. if I try compiling the following:

(define-library (java)
                 (export get-num)
                 (import (scheme base))

                 (begin
                   (define (get-num) ((String "hello"):length))
                 ))

$ kawa --r7rs -C java.sld(compiling java.sld to java)
java.sld:7:54: warning - no declaration seen for :length

$ kawa --r7rs try-java.sps java.sld:7:54: unbound location: :length
     at gnu.mapping.SharedLocation.get(SharedLocation.java:22)
     at gnu.mapping.DynamicLocation.get(DynamicLocation.java:28)
     at java.getNum(java.sld:7)

If I rewrite get-num to use invoke, I still get compilation warnings, 
but it works at runtime.


If the answer's no, that's ok: I think Kawa's modules will interact all 
right with my other code.  I'm just partial to the R7RS form.

   thanks for any suggestions

        Peter.

--
Peter Lane
http://peterlane.info/scheme.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: R7RS Libraries and Java interaction
  2017-03-22 20:55 R7RS Libraries and Java interaction Peter Lane
@ 2017-03-22 21:15 ` Per Bothner
  0 siblings, 0 replies; 2+ messages in thread
From: Per Bothner @ 2017-03-22 21:15 UTC (permalink / raw)
  To: Peter Lane, kawa

On 03/22/2017 01:55 PM, Peter Lane wrote:

> Is it possible to make an R7RS library recognise Java interaction when compiled?
>
> e.g. if I try compiling the following:
>
> (define-library (java)
>                 (export get-num)
>                 (import (scheme base))
>
>                 (begin
>                   (define (get-num) ((String "hello"):length))
>                 ))
>
> $ kawa --r7rs -C java.sld(compiling java.sld to java)
> java.sld:7:54: warning - no declaration seen for :length

It seems to work if you leave off the --r7rs flag.

The --r7rs disables features that conflict with R7RS, such as the special
meaning of colon, since in R7RS colon is just a regular symbol character.
You don't need it for this example.

> $ kawa --r7rs try-java.sps java.sld:7:54: unbound location: :length
>     at gnu.mapping.SharedLocation.get(SharedLocation.java:22)
>     at gnu.mapping.DynamicLocation.get(DynamicLocation.java:28)
>     at java.getNum(java.sld:7)
>
> If I rewrite get-num to use invoke, I still get compilation warnings, but it works at runtime.

That can be fixed by adding:

    (import (only (kawa base) invoke))
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-22 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22 20:55 R7RS Libraries and Java interaction Peter Lane
2017-03-22 21:15 ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).