Menu

#42 read/write invariance broken for some symbols

closed-fixed
nobody
None
5
2003-05-21
2003-05-11
No

(let ([x (string->symbol "1")])
(eq? (with-input-from-string
(with-output-to-string
(lambda () (write x)))
(lambda () (read)))
x))
;=> '#f

|string->symbol| returns a symbol. |write| renders this
as \1 which |read| reads as the *number* 1.

One way to fix this would be to write |\1| instead, but
I don't know how difficult this would be and whether it
would break anything else.

Discussion

  • Scott G. Miller

    Scott G. Miller - 2003-05-11

    Logged In: YES
    user_id=25869

    Well, with pipe characters, I'm not even sure the backslash
    would be necessary, but pipes are the way to go. mzscheme
    does this. Surprisingly, this is broken in Scheme48 as well.

     
  • Matthias Radestock

    Logged In: YES
    user_id=110070

    Fixed in CVS.

     
  • Matthias Radestock

    • status: open --> closed-fixed
     

Log in to post a comment.