From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#26629: 25.1.50; Feature-request: Structure-preserving copying of sequences Date: Fri, 13 May 2022 13:47:53 -0400 Message-ID: References: <874lxepytq.fsf@smtp.1und1.de> <87ee0x1k5a.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30477"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 26629@debbugs.gnu.org, Tobias Zawada To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 13 19:49:19 2022 Return-path: Envelope-to: geb-bug-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 1npZPi-0007jX-Vm for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 19:49:19 +0200 Original-Received: from localhost ([::1]:58284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npZPh-0004Ao-Hk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 13:49:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npZPV-00048Z-C2 for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 13:49:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npZPS-0003tS-Pq for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 13:49:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npZPS-0003eh-IH for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 13:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 May 2022 17:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 26629-submit@debbugs.gnu.org id=B26629.165246408413908 (code B ref 26629); Fri, 13 May 2022 17:49:02 +0000 Original-Received: (at 26629) by debbugs.gnu.org; 13 May 2022 17:48:04 +0000 Original-Received: from localhost ([127.0.0.1]:44954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npZOW-0003cF-DN for submit@debbugs.gnu.org; Fri, 13 May 2022 13:48:04 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npZOU-0003b4-0q for 26629@debbugs.gnu.org; Fri, 13 May 2022 13:48:02 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1117280390; Fri, 13 May 2022 13:47:56 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A6B9D805CE; Fri, 13 May 2022 13:47:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1652464074; bh=082OFLLNqz+r+S32OCrurqZbqK0q+os57fRhVoOC+PA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BdLfZmqioZnox9KVc5y7kP9aMCcNDxV1tkC2mpxgIXm+ysPd6gD1lWQX0hGH1emZl vyiFXiKFzZhdQ6BtHmb4LiDKuImBdmIE1GTOEkGWTgAC3Vz/IPmW1Fz6dQqeyAJoMg 3iq5RL2ich3QUUmNSpq5LdJxJ7Hzr2NQbF0N2DqjpuUZ3T0DuSUmALENXZk7zR6kvU X6ebO7OizEPZ92HZT/kmYccvg37dPPkV/T24dzPCCbLVWjJPWYX5/+J09rhY9b2BPu UfxH9k4Ech+COc6EuKkpOBy1OvxjRJO5zFdZAqG9kOi8KR37rHE5UxOW0iUw2DOfva hZomE1DlklHng== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 782FF120812; Fri, 13 May 2022 13:47:54 -0400 (EDT) In-Reply-To: <87ee0x1k5a.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 13 May 2022 18:18:09 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232184 Archived-At: > I haven't looked closely at the code, but this is functionality that I > vaguely remember having been requested before, and I don't think Emacs > has it yet? (But I may be wrong about that.) > I've added Stefan to the CCs; perhaps he has some comments. My opinion is rather negative: IMO `copy-tree` itself is a bad function in the sense that it's (almost) never really right, IOW most uses of `copy-tree` are fundamentally quick hacks which happen to work most of the time because the details of when to recurse and when not to very rarely map exactly to "recurse on `cons` and only `cons`". So rather than `copy-tree*` I'd rather see some kind of generic `deep-copy` function which takes a (or some) parameter(s) that indicates when (and potentially how) to copy/recurse each of the elements (where `deep-copy`s job would thus be mainly to take care of maintaining the hash-map and maybe using an explicit stack to avoid deep recursion). Stefan