guile-user
[Top][All Lists]
Advanced

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

Re: Fwd: string is read-only


From: Maxime Devos
Subject: Re: Fwd: string is read-only
Date: Wed, 3 Aug 2022 11:59:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0


On 03-08-2022 11:51, Damien Mattei wrote:
ok
and i suppose it is the standard, i have been confused by other schemes or racket where my code worked:

It happens to work in Guile too, when you use the interpreter instead of the compiler:

scheme@(guile-user)> (eval `(let ((a ,(string-copy "foo"))) (string-set! a 0 #\b) a) (current-module))
$1 = "boo"
However, as implied by <https://lists.gnu.org/archive/html/guile-devel/2012-01/msg00135.html>, it's not something to rely upon.  (Maybe 'eval' should make all strings it encounters in the S-exp read-only first with substring/read-only, assuming that doesn't come with a performance cost.)

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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