From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: string is read-only Date: Wed, 3 Aug 2022 11:42:16 +0200 Message-ID: <413a34c2-1776-f20f-811a-a9403965484b@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32396"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: Damien Mattei , guile-user , guile-devel Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Aug 03 11:49:48 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 1oJB0d-0008JG-SF for guile-user@m.gmane-mx.org; Wed, 03 Aug 2022 11:49:47 +0200 Original-Received: from localhost ([::1]:35256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJB0b-0005Do-F5 for guile-user@m.gmane-mx.org; Wed, 03 Aug 2022 05:49:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJAtU-0007vG-CO; Wed, 03 Aug 2022 05:42:24 -0400 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJAtS-0007Cb-Mq; Wed, 03 Aug 2022 05:42:24 -0400 Original-Received: by mail-wr1-x436.google.com with SMTP id v3so19948506wrp.0; Wed, 03 Aug 2022 02:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=XnGDg90pVMxjMP4I22wmWIFE9ySsNX9MmBdFKcdP18s=; b=fKlycH6MyKL1q/VYvQFQqWymde6BwH2AS2ALuJ/j0dRinIoPcI26V+Mn8r/QWeJl4Q uxmYLbJhYFPYhVbHp+9p7LhSwsgXe7554dnJZcg6q0U4TqoKlifop5u3LoQ5k8nU6HmX GF/co4T0ZVSuq/tVsrPPfG3YrnQA8wGTs71hBWTCm9fxCLJvrsPwnj3PzqeVhwKMvIPt 8pajTQg9pQubYsxOFtMlb+E3pUNbcQoVaC4sVpHuB4XLY35ZqIxBh+cbQk/szALou3NC 09EVzTyjUuIPnVurrKlMx6bc0rLGKL2XJOtqNAHoWJy2o8aoX6FJObqGv94vxnVbS7GR G5rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=XnGDg90pVMxjMP4I22wmWIFE9ySsNX9MmBdFKcdP18s=; b=XUqm/MpU6fI+y2tS+JetKngc4QvTJlVaTAoKxza6PW/5HZPj7Y5rMuoGhMY1qy17vX OmOOGTUCnap7nK4DNWQcwP1tPkbuODN3nkiuvhv2h22ang/lkqPgK/N+48BX97DrwmNE JYvTM/k1JyPaub2c6AU55Dr+zBjwqS0kYTRAx/a11EMnyw8mKDgOVJ1txF/jQAbsOl1g VFEkCxSJXhT5x2/mOmeU7wrI2TQMou340kpcDek2sT49kppZYrh9415Q8iE6Bo54spjW GqQ5ywWVocyGaX15vhEoQwJqCuzNk5BzFs3LhCCrjAfq6PE9LCHKIRq/ZuxxZZ38RuEs H8Bg== X-Gm-Message-State: ACgBeo1zw3jVkrJKnQ0fAcNIrL2WbA7IqgbKAbUgaaA0hpEhW++2YaqA OXQTJo1HTNfNBbFNmpomSV4= X-Google-Smtp-Source: AA6agR4kQHnpDKTOPGm+0z6tbhZSE90vge0DABtwhLsSqfr0WZ+9fgYIJ5cv7axOx5+lC/aQHqOJBA== X-Received: by 2002:adf:da42:0:b0:21d:aa7e:b1da with SMTP id r2-20020adfda42000000b0021daa7eb1damr15917224wrl.330.1659519740220; Wed, 03 Aug 2022 02:42:20 -0700 (PDT) Original-Received: from [192.168.178.20] (ip-109-090-125-150.um36.pools.vodafone-ip.de. [109.90.125.150]) by smtp.gmail.com with ESMTPSA id n123-20020a1ca481000000b003a31f71c5b8sm2167583wme.27.2022.08.03.02.42.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Aug 2022 02:42:19 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:18473 gmane.lisp.guile.devel:21279 Archived-At: On 03.08.2022 11:12, Damien Mattei wrote: > GNU Guile 3.0.1 > Copyright (C) 1995-2020 Free Software Foundation, Inc. > > 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. > > 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" > > Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue. > scheme@(guile-user) [1]> ,q > scheme@(guile-user)> (string? str2) > #t > > is it a bug in Guile ? :-O > > 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-Strings.html#Read%20Only%20Strings > > Regards, > > Damien String literals are constants, and it's intentional. I'm not sure if it's mentioned anywhere in the manual. If you want to get a mutable string from a literal, you can use: (define str (string-copy "foobar")) -- Taylan