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 13:22:42 +0200 Message-ID: <874keca73x.fsf@mbork.pl> References: <87h7ifa932.fsf@mbork.pl> <0404DE66-DD17-41F2-B6CC-EC06937CD152@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="19647"; 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 13:23:47 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 1lpUP5-0004wt-Fu for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 13:23:47 +0200 Original-Received: from localhost ([::1]:59966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpUP4-0001wk-Cn for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 07:23:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpUOV-0001wV-MT for help-gnu-emacs@gnu.org; Sat, 05 Jun 2021 07:23:11 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:48516) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpUOR-0002wL-Di for help-gnu-emacs@gnu.org; Sat, 05 Jun 2021 07:23:11 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 69800E6B44; Sat, 5 Jun 2021 13:22:54 +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 Fzjtj8xOuUOy; Sat, 5 Jun 2021 13:22:44 +0200 (CEST) Original-Received: from localhost (apn-37-248-138-16.dynamic.gprs.plus.pl [37.248.138.16]) by mail.mojserwer.eu (Postfix) with ESMTPSA id B9415E61D9; Sat, 5 Jun 2021 13:22:43 +0200 (CEST) In-reply-to: <0404DE66-DD17-41F2-B6CC-EC06937CD152@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_HELO_NONE=0.001, SPF_PASS=-0.001 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:130545 Archived-At: 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 - see e.g. my blog post here: http://mbork.pl/2016-05-23_Literal_values_and_destructive_functions). Also, I thought symbols are immutable. Can you provide an example showing that they aren't? TIA, -- Marcin Borkowski http://mbork.pl