From: szgyg <szgyg@ludens.elte.hu>
To: bug-guile@gnu.org
Subject: Re: string-set! examples in r5rs.html
Date: Sat, 27 Sep 2008 13:45:46 +0200 [thread overview]
Message-ID: <48DE1CEA.10303@ludens.elte.hu> (raw)
In-Reply-To: <873ajr6gcx.fsf@gnu.org>
Ludovic Courtes writes:
> "Bill Schottstaedt" writes:
>
>> according to r5rs.html, these should signal an error, I believe:
>>
>> guile> (string-set! (symbol->string 'immutable)
>> 0
>> #\?)
>> 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)
"12345"
Backtrace:
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)
-------
szgyg
[1]
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-4.html#%_sec_1.3.2
[2]
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-8.html#node_idx_248
[3]
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-6.html#%_idx_76
next prev parent reply other threads:[~2008-09-27 11:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-19 20:31 string-set! examples in r5rs.html Bill Schottstaedt
2008-09-22 21:05 ` Ludovic Courtès
2008-09-22 22:50 ` Neil Jerram
2008-09-23 16:54 ` Ludovic Courtès
2008-09-23 20:33 ` Neil Jerram
2008-09-27 11:45 ` szgyg [this message]
2008-09-28 20:18 ` Ludovic Courtès
2008-10-09 21:32 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48DE1CEA.10303@ludens.elte.hu \
--to=szgyg@ludens.elte.hu \
--cc=bug-guile@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).