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.devel,gmane.lisp.guile.user Subject: Re: string is read-only Date: Wed, 3 Aug 2022 12:30:50 +0200 Message-ID: <0474dc97-a009-7d0c-8fc8-fe831f13223a@gmail.com> References: <413a34c2-1776-f20f-811a-a9403965484b@gmail.com> <3AEB472A-96A2-4E7D-82BA-4294B8D8099D@abou-samra.fr> 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="1478"; 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 Cc: Damien Mattei , guile-user , guile-devel To: Jean Abou Samra Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Aug 03 12:32:59 2022 Return-path: Envelope-to: guile-devel@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 1oJBgQ-0000BU-SR for guile-devel@m.gmane-mx.org; Wed, 03 Aug 2022 12:32:58 +0200 Original-Received: from localhost ([::1]:34168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJBgM-0002ee-BY for guile-devel@m.gmane-mx.org; Wed, 03 Aug 2022 06:32:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJBeU-0001gF-Ex; Wed, 03 Aug 2022 06:30:58 -0400 Original-Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:41552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJBeS-0003vM-O0; Wed, 03 Aug 2022 06:30:58 -0400 Original-Received: by mail-wr1-x432.google.com with SMTP id p10so16812863wru.8; Wed, 03 Aug 2022 03:30:56 -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:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=ucI2wDw9r6nlpfFpS3BtA2zQDVO0aqzdw0PxsYCcA9w=; b=ltAJy9slD5G8Z0FJWUkEpwJEkJynWlAKqXghc+mF9xluTrRz/T2ZHI5GakoxC6iLQD 7ivqJVrUE4jb9948lJi1/Yq3d4JdOt/bzDBLka4SSwMT7JcS9ul84RnS11xuNOUUtJwT SURJrWTA+sJyblzunU3emt6cQHXO0rWBG9ooYqro+7LuEid9ZgsBLAaGFu4pKA6NPF2M Kd9Aat4VWCY9PLy5F1JRN6/+S8rv+d5uw1Xl6P4NIvOlTUufkU7XoxVMF16JbsSFd+Mb 77mYAj1hogvP2SPtRrNjxtm0/I9CMSBOcP1YaqcDn2IDhZnM1mPt7lURfCiKdESCwasc fAEQ== 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:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=ucI2wDw9r6nlpfFpS3BtA2zQDVO0aqzdw0PxsYCcA9w=; b=gaoSAa0B/oGY3rjihgfsEL0va0SUL/ZHl+2jDFcf76y5ajuowvnScwWGeIXu63cuGk qosqD3/pHFL6ddc2Vk0GccL0FrrMJJminGAj+BkfkyNpBNGI5FRPh0QpP5UdS94Vgqax fznGWicgzc00plAtcbMVqVMHo9q6bQZXRJMkgqu+eE/8WsOAI1cTmUVpYnk7XBGlHtlF YUMBFGjC1CmLVEVL/yIqD/gh/PS35c5XKL2qCXYQZBdBVyYpWmirnFdz8J4pMPqBMsZm de/ZN1WMk3FfCJIKT2adyfbLV23L0ogMLpgK792bW4YBUsgIIWnMs37bSwoR9tyqhjJA Rlog== X-Gm-Message-State: ACgBeo0/3VrY1K8yf/j3RnGeQwfTM+ECYP3nxXADGvZXO0eFMCxTeD/s LWUgbSgbr8YE5bvQKtwugck= X-Google-Smtp-Source: AA6agR6LMBggYcSHSygcEI6FbBlGBZP4hKb6v5ObcJxpEYBsr/aZKVrgdQ3nIPLYIHNKP/6TTB11bQ== X-Received: by 2002:adf:e6ce:0:b0:220:5e20:ce80 with SMTP id y14-20020adfe6ce000000b002205e20ce80mr10640238wrm.13.1659522654523; Wed, 03 Aug 2022 03:30:54 -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 a5-20020adffb85000000b0021e5cc26dd0sm17644927wrr.62.2022.08.03.03.30.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Aug 2022 03:30:53 -0700 (PDT) Content-Language: en-US In-Reply-To: <3AEB472A-96A2-4E7D-82BA-4294B8D8099D@abou-samra.fr> Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x432.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-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21284 gmane.lisp.guile.user:18478 Archived-At: On 03.08.2022 11:50, Jean Abou Samra wrote: > > >> Le 3 août 2022 à 11:49, Taylan Kammer a écrit : >> >> 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 > > This is standard. See the intro of > > https://srfi.schemers.org/srfi-135/ > >> This SRFI defines a new data type, which is not really relevant here. As far as I know, Guile doesn't support it yet anyway. -- Taylan