[Larceny-users] Random data stored by bytevector-set! if the value to store is any non-fixnum

Lars T Hansen lth at acm.org
Sun Jul 15 15:46:31 EDT 2012


The following is probably related in some way to
https://trac.ccs.neu.edu/trac/larceny/ticket/342, but I don't know
that I have credentials to log in and comment directly.

Larceny 0.97 on Windows, running under Cygwin:

$ larceny.bin
Larceny v0.97 "Funny in the Head" (Aug 19 2009 14:35:39, precise:Win32:unified)

> (define x (make-bytevector 1))

> (bytevector-set! x 0 #i0)
#vu8(141)

> (bytevector-set! x 0 #i0)
#vu8(93)

This appears to happen for other inexact values than #i0 as well, and
for fractions such as 3/2, and indeed for any non-fixnum I've tried.
Fixnums are truncated.

Almost any behavior would be more useful than storing random data
here.  The context in which I ran into this problem would have liked
for the improved behavior to be an error message, and judging from the
behavior of eg fx+ on inexacts I suspect that is probably most in
keeping with the language as a whole, but that's just a suggestion.

--lars



More information about the Larceny-users mailing list