public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Mark Raynsford <list+org.sourceware.kawa@io7m.com>
To: kawa@sourceware.org
Subject: Difference in define behaviour between kawa.jar and embedded Scheme example
Date: Wed, 22 Nov 2017 22:33:00 -0000	[thread overview]
Message-ID: <20171122223308.6b39e57d@copperhead.int.arc7.info> (raw)

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

I have the following trivial example:

https://raw.githubusercontent.com/io7m/kawa-experiments/develop/src/main/resources/com/io7m/kawa_exp/demo0.scm

If I evaluate it on the command line:

$ java -jar kawa-3.0/lib/kawa.jar
#|kawa:1|# (define (six0 x) (+ 3 3))
#|kawa:2|# (define (+ x y) (* x y))
#|kawa:3|# (define (six1 x) (+ 3 3))
#|kawa:4|# (six0 0)
6
#|kawa:5|# (six1 0)
9

This is the behaviour I'd expect. If I then try (what appears to be)
the same thing from Java:

https://raw.githubusercontent.com/io7m/kawa-experiments/develop/src/main/java/com/io7m/kawa_exp/SchemeExp0.java

The program prints:

22:30:02.499 [main] DEBUG com.io7m.kawa_exp.SchemeExp0 - result: 9, 9

In other words, the redefinition of + on the second line is affecting
the existing definition of six0 so that the applications of six0 and
six1 are both returning 9. What's going on here?

This is an unmodified kawa jar from the 3.0 binary distribution.

-- 
Mark Raynsford | http://www.io7m.com


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2017-11-22 22:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 22:33 Mark Raynsford [this message]
2017-11-23  2:26 ` Per Bothner
2017-11-23 10:52   ` Mark Raynsford
2017-11-23 12:51     ` Per Bothner

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=20171122223308.6b39e57d@copperhead.int.arc7.info \
    --to=list+org.sourceware.kawa@io7m.com \
    --cc=kawa@sourceware.org \
    /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).