Summary

integer->char doesn't work right with negative numbers

Metadata

Description

(integer->char -1) => #\U1fffff but (char->integer #\U1fffff) => 2097151

Found this when trying to make a non-blocking ncurses app: getch and friends return -1 when there's no ready input.

Changes and comments

[2011-04-27 12:15:09 UTC] felix changed status from new to assigned

[2011-04-27 12:15:09 UTC] felix set owner to felix

[2011-04-27 12:15:09 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-04-27 12:15:09 UTC] felix wrote:

Probably `integer->char` should catch this and throw an error. But this will require yet another runtime check. I'll add a note to the manual for the time being.

[2011-09-17 15:00:32 UTC] felix removed owner felix

[2011-11-03 14:39:59 UTC] felix changed status from assigned to closed

[2011-11-03 14:39:59 UTC] felix set resolution to wontfix

[2011-11-03 14:39:59 UTC] felix wrote:

Currently `integer->char` can be completely inline. Adding such a check seems prohibitive, since this primitive is used extensively in internal string-processing procedures.

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0