public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Peter Lane <peter@peterlane.info>, kawa@sourceware.org
Subject: Re: R7RS Libraries and Java interaction
Date: Wed, 22 Mar 2017 21:15:00 -0000	[thread overview]
Message-ID: <0c8cd4f3-6818-9e4d-c965-141eb090fbde@bothner.com> (raw)
In-Reply-To: <788f96d2-c723-f38b-077b-1b6040aa6a16@peterlane.info>

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/

      reply	other threads:[~2017-03-22 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 20:55 Peter Lane
2017-03-22 21:15 ` Per Bothner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c8cd4f3-6818-9e4d-c965-141eb090fbde@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    --cc=peter@peterlane.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).