> From: Bruce Korb <bruce.k...@gmail.com>
> My "(get ...)" function always returns a string. > This result was assigned to "tmp-text" and the > "(string-upcase ...)" is complaining that the input is > read only. Well, it isn't, so the real complaint > is being hidden by the "string is read-only" message. > > It worked until I "upgraded" to openSuSE 12.1. > >> $ guile --version >> guile (GNU Guile) 2.0.2 >> ..... > > What is really wrong, please? > >> >> (set! tmp-text (get "act-text")) >> (set! TMP-text (string-upcase tmp-text)) >> (string-append >> (if (exist? "no") "no-" "yes-") >> (get "act-type")) > There does seem to be some strangeness w.r.t. read-only strings going on. On Guile 1.8.8 if you create a string this way, it is not read-only. guile> (define y "hello") guile> (string-set! y 0 #\x) guile> y "xello" On Guile 2.0.3, if you create a string the same way, it is read-only for some reason. scheme@(guile-user)> (define y "hello") scheme@(guile-user)> (string-set! y 0 #\x) ERROR: In procedure string-set!: ERROR: string is read-only: "hello" %string-dump can be used to confirm this scheme@(guile-user)> (%string-dump y) $4 = ((string . "hello") (start . 0) (length . 5) (shared . #f) (read-only . #t) (stringbuf-chars . "hello") (stringbuf-length . 5) (stringbuf-shared . #f) (stringbuf-wide . #f)) But if you create a string with 'string' it isn't read only scheme@(guile-user)> (define y (string #\h #\e #\l #\l #\o)) scheme@(guile-user)> (string-set! y 0 #\x) scheme@(guile-user)> y $7 = "xello" -Mike