From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Abou Samra Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: string is read-only Date: Wed, 3 Aug 2022 11:50:37 +0200 Message-ID: <3AEB472A-96A2-4E7D-82BA-4294B8D8099D@abou-samra.fr> References: <413a34c2-1776-f20f-811a-a9403965484b@gmail.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18451"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Damien Mattei , guile-user , guile-devel To: Taylan Kammer Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Aug 03 12:03:19 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJBDi-0004Xe-Ch for guile-user@m.gmane-mx.org; Wed, 03 Aug 2022 12:03:18 +0200 Original-Received: from localhost ([::1]:56102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJBDh-0003K0-AF for guile-user@m.gmane-mx.org; Wed, 03 Aug 2022 06:03:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJB1Y-0006j8-BP; Wed, 03 Aug 2022 05:50:44 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.10]:55047) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJB1W-0001uE-8T; Wed, 03 Aug 2022 05:50:44 -0400 Original-Received: from smtpclient.apple ([37.167.159.6]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.184]) with ESMTPSA (Nemesis) id 1Mg6mG-1nmtCy4034-00hedp; Wed, 03 Aug 2022 11:50:39 +0200 In-Reply-To: <413a34c2-1776-f20f-811a-a9403965484b@gmail.com> X-Mailer: iPhone Mail (19F77) X-Provags-ID: V03:K1:2RkVPFp4em4CNQRMTMCMPgTPjpDyOykf2DL4gCYyJmQc0s0k6xG pEU+vWWXv9n83zxFT+hSxasqD55prGqEVuU/SdBvcS2h2Jn0Ibc4+bC9JqVZH3MshhhMQGE F13JpOqqAt5rvc5/jaXfZ+9XIB4PI9qoeS24VKqLQGH6jOFjUrrd64Jo+vdU003+l+6eKbe S7fKgSFChcnQ4vVxoOY8g== X-UI-Out-Filterresults: notjunk:1;V03:K0:XbPXzelT4Js=:s4ZerGJZcuwub93fHh23ec 3s0EN/LRo2QRaxZtPJnFJoeuBlorQfYjPGI37ny467hlIUtI/Bt5l8DFmN3E8da3kw8f7SeqX UL94Dbsv62Fu+bB19VMyxLzoOmvcoeBCJt8uANgbbHwVWIWmH75yjEn4HsnR9OTUKcIjF3wo3 oAKNzaIgBgZ83V+3DOgDJKiZ3WG6jCey8RuhJgWs80U+vjv0pD9jtuZOcEBkRH2cClVqwH1Pd igZ7B4+J0jeit9BVesuY5rv2i+EVlJtYw6oqpFwexXgAmRO0Zb/tFLjR3YstBuMJrGGn9PPMn nr3KKeYGi5wfhmjN7yxTGMH2DxRcp9VFzCTDOBOInHdqAB7bt1R6M+/YOMhfQYNQpE79CxD9C xqftklA2koTyvBhU28KOds8kJpqEbGUWvdV/qQHpDCiFBDlE4hKn0D/vaOy2X/VVQTTJNvdyJ ZJAMVwAJ8dPQ32obz4pMFdjMs/jXnVagIsXnPzNkfLEM5MjSxmazpJmENu66Q6NS0COa5GB2p 5Qn6e/O8GeBOpd7FCjZ8I/2dT1rSnGjzj9bCde6E29ve5BMJs0VaDsRI0br0vKYcZKBIxNHa+ x3QWypw9JHIwmhB6WFvSHcy/Kxiul3FFqnJ7m48yonvmK28fZPho4pdpjhefFWVfZF7HopFa3 H9/4gs8VlwfwwcH4hF4swXd2ema5kHf9UwgDJN1ZXlx+jtmiy1GaUmsZKXdQkDj+SdMl8Yqj/ mpHXPfnY/rdUxOsaYUqzpVxwOlaNPqFWqI5X2g== Received-SPF: none client-ip=212.227.17.10; envelope-from=jean@abou-samra.fr; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18476 gmane.lisp.guile.devel:21282 Archived-At: > Le 3 ao=C3=BBt 2022 =C3=A0 11:49, Taylan Kammer a= =C3=A9crit : >=20 > =EF=BB=BFOn 03.08.2022 11:12, Damien Mattei wrote: >> GNU Guile 3.0.1 >> Copyright (C) 1995-2020 Free Software Foundation, Inc. >>=20 >> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. >> This program is free software, and you are welcome to redistribute it >> under certain conditions; type `,show c' for details. >>=20 >> Enter `,help' for help. >> scheme@(guile-user)> (define str2 "hello") >> scheme@(guile-user)> (string-set! str2 4 #\a) >> ice-9/boot-9.scm:1669:16: In procedure raise-exception: >> string is read-only: "hello" >>=20 >> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. >> scheme@(guile-user) [1]> ,q >> scheme@(guile-user)> (string? str2) >> #t >>=20 >> is it a bug in Guile ? :-O >>=20 >> i can only find reference to deprecated read-only string in old doc: >> https://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/Read-Only-Stri= ngs.html#Read%20Only%20Strings >>=20 >> Regards, >>=20 >> Damien >=20 > String literals are constants, and it's intentional. >=20 > I'm not sure if it's mentioned anywhere in the manual. >=20 > If you want to get a mutable string from a literal, you can use: >=20 > (define str (string-copy "foobar")) >=20 > --=20 > Taylan This is standard. See the intro of https://srfi.schemers.org/srfi-135/ >=20