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]

Difference in define behaviour between kawa.jar and embedded Scheme example


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: pgp7R4wHjPCVF.pgp
Description: OpenPGP digital signature


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