[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-set! examples in r5rs.html

From: szgyg
Subject: Re: string-set! examples in r5rs.html
Date: Sat, 27 Sep 2008 13:45:46 +0200
User-agent: Thunderbird (Windows/20080914)

Ludovic Courtes writes:
"Bill Schottstaedt" writes:

according to r5rs.html, these should signal an error, I believe:

guile> (string-set! (symbol->string 'immutable)
guile> (define (g) "***")
guile> (string-set! (g) 0 #\?)
guile> (g)

Not in R5RS. [1] But R6RS requires reporting. [2]

The attached patches against 1.8.x fix this.

Neil: OK to apply?

No, (read) should return mutable string.

"literal constants and the strings returned by symbol->string are immutable objects, while all objects created by the other procedures listed in this report are mutable." [3]

So scm_read_string() should behave differently when reads program and data.

#;> (string-set! (read) 2 #\X)

In current input:
   1: 0* [string-set! "12345" 2 #\X]

<unnamed port>:1:1: In procedure string-set! in expression (string-set! (read) 2 ...):
<unnamed port>:1:1: string is read-only: "12345"
ABORT: (misc-error)


[1] http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-4.html#%_sec_1.3.2
[3] http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-6.html#%_idx_76

reply via email to

[Prev in Thread] Current Thread [Next in Thread]