Discussion:
[Larceny-users] Random data stored by bytevector-set! if the value to store is any non-fixnum
Lars T Hansen
2012-07-15 19:46:31 UTC
Permalink
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
Felix S Klock II (Larceny-users list proxy)
2012-07-16 12:14:47 UTC
Permalink
Lars (cc'ing larceny-users)-

I will copy your message into a comment on the ticket.

----

If you would like to do updates yourself to the trac data in the
future, according to the CCS trac website:

https://trac.ccs.neu.edu/pr/

you can register for a trac account by following this link:

https://trac.ccs.neu.edu/pr/user/register

(I don't remember what the next steps are from there to give you
credentials e.g. for making comments, creating tickets, etc. But an
account seems like the right first step.)

Cheers,
-Felix
Post by Lars T Hansen
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.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
_______________________________________________
Larceny-users mailing list
https://lists.ccs.neu.edu/bin/listinfo/larceny-users
Loading...