From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Which Elisp types are mutable? Date: Sat, 05 Jun 2021 21:19:35 +0200 Message-ID: <8735tw9l14.fsf@mbork.pl> References: <87h7ifa932.fsf@mbork.pl> <0404DE66-DD17-41F2-B6CC-EC06937CD152@gmail.com> <874keca73x.fsf@mbork.pl> <70773EA8-6549-4C03-941C-FADAB1BE441A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3000"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.1.0; emacs 28.0.50 Cc: Help Gnu Emacs mailing list To: Philipp Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 05 21:21:06 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1lpbr0-0000aB-S3 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 21:21:06 +0200 Original-Received: from localhost ([::1]:55718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpbqz-00089D-O4 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 15:21:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpbq9-0007K5-EW for help-gnu-emacs@gnu.org; Sat, 05 Jun 2021 15:20:13 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:52236) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpbq1-00028o-HL for help-gnu-emacs@gnu.org; Sat, 05 Jun 2021 15:20:13 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id F2EB1E6B44; Sat, 5 Jun 2021 21:19:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fuXy1sRttSP6; Sat, 5 Jun 2021 21:19:49 +0200 (CEST) Original-Received: from localhost (178235147193.dynamic-3-poz-k-0-1-0.vectranet.pl [178.235.147.193]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 3BEEFE61D9; Sat, 5 Jun 2021 21:19:49 +0200 (CEST) In-reply-to: <70773EA8-6549-4C03-941C-FADAB1BE441A@gmail.com> Received-SPF: pass client-ip=195.110.48.8; envelope-from=mbork@mbork.pl; helo=mail.mojserwer.eu X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130554 Archived-At: On 2021-06-05, at 14:58, Philipp wrote: >> Am 05.06.2021 um 13:22 schrieb Marcin Borkowski : >> >> >> On 2021-06-03, at 14:11, Philipp wrote: >> >>>> Am 03.06.2021 um 06:03 schrieb Marcin Borkowski : >>>> >>>> Well, the subject says it all. I could find an explicit, comprehensive >>>> list of mutable (or immutable) types in the Elisp manual. Is it there >>>> somewhere? >>> >>> Mutability is a property of objects, not types. >>> Some objects (numbers) are always immutable, others (markers, buffers, ...) are always mutable. But objects of most "interesting" types (strings, lists, vectors, symbols) can be either mutable or immutable. >>> Some time ago, I filed https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43557 to document which objects are mutable, but unfortunately it's not yet fixed. >> >> Thanks. However, I still don't understand. How can a list be >> immutable? What about a string? I thought these are _always_ mutable >> (although in some cases you must not mutate them, because if you do, bad >> things could happen > > "You must not mutate them" is the definition of immutable. Well, in my book, "you can't mutate them" is. You always /can/ mutate a string, but of you do it in certain circumstances, you're asking for trouble. >> Also, I thought symbols are immutable. Can you provide an example >> showing that they aren't? > > Symbols are probably a weird case terminology-wise. Here I define "mutable symbol" as symbol whose value and function slots can be changed (true for most symbols except keywords). However, arguably other definitions are possible, depending on whether you see their values and function slots as "part of a symbol" or as something they refer to. (The manual doesn't specify this.) Ah, I see. For me, a symbol is one thing, and what is in its function/value/properties cells is another. Best, -- Marcin Borkowski http://mbork.pl