From: Maxime Devos <maximedevos@telenet.be>
To: Damien Mattei <damien.mattei@gmail.com>,
guile-devel <guile-devel@gnu.org>,
guile-user <guile-user@gnu.org>
Subject: Re: Fwd: string is read-only
Date: Wed, 3 Aug 2022 11:59:39 +0200 [thread overview]
Message-ID: <ffcbc472-bf43-ac4d-a964-c68033d561d1@telenet.be> (raw)
In-Reply-To: <CADEOadcArxQevHcS3N=CCMa4VHq7qJY9ifUpCS1LRo4Sx0VP-Q@mail.gmail.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 704 bytes --]
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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2022-08-03 9:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 9:12 string is read-only Damien Mattei
2022-08-03 9:32 ` Thomas Morley
[not found] ` <CADEOadctjXAyZfwYG3Qbky129i0NBbM+HK6g1iUwvA_HrT4UxA@mail.gmail.com>
2022-08-03 9:51 ` Fwd: " Damien Mattei
2022-08-03 9:59 ` Maxime Devos [this message]
2022-08-03 9:41 ` Maxime Devos
2022-08-03 9:57 ` Ricardo G. Herdt
2022-08-03 10:55 ` Damien Mattei
2022-08-03 10:59 ` Maxime Devos
2022-08-03 11:34 ` Damien Mattei
2022-08-03 9:42 ` Taylan Kammer
2022-08-03 9:50 ` Jean Abou Samra
2022-08-03 10:30 ` Taylan Kammer
2022-08-03 10:33 ` Jean Abou Samra
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=ffcbc472-bf43-ac4d-a964-c68033d561d1@telenet.be \
--to=maximedevos@telenet.be \
--cc=damien.mattei@gmail.com \
--cc=guile-devel@gnu.org \
--cc=guile-user@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).