Hi Mike,
Thank you for the explanation. However:
On 01/03/12 07:03, Mike Gran wrote:
It worked until I "upgraded" to openSuSE 12.1.
$ guile --version
guile (GNU Guile) 2.0.2
.....
(set! tmp-text (get "act-text"))
(set! TMP-text (string-upcase tmp-text))
>>> ERROR: In procedure string-upcase:
ERROR: string is read-only: ""
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
There are a couple of issues:
1. "string-upcase" should only read the string
(as opposed to "string-upcase!", which rewrites it).
2. it is completely, utterly wrong to mutilate the
Guile library into such a contortion that it
interprets this:
(define y "hello")
to be a request to create an immutable string anyway.
It very, very plainly says, "make 'y' and fill it with
the string "hello". Making it read only is crazy.
Furthermore, I do not even have an obvious way to deal
with the problem, short of a massive rewrite.
I define variables this way all over the place.
rewriting the code to
(define y (string-append "hell" "o"))
everywhere is stupid, laborious, time consuming for me,
and time consuming at execution time.
Guile 2.0.1, 2.0.2 and 2.0.3 need some rethinking. Dang!!!!!