From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#62117: 29.0.60; cl-letf on a map place has side-effects Date: Sat, 11 Mar 2023 08:44:26 +0100 Message-ID: <875yb7vijp.fsf@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="13243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 62117@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 11 08:45:26 2023 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 1patuw-0003IV-Cy for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Mar 2023 08:45:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1patua-0000oM-VB; Sat, 11 Mar 2023 02:45:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1patuZ-0000oC-7M for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:45:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1patuY-0003AK-Tw for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1patuY-0004mo-8J for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Mar 2023 07:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62117 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167852067518340 (code B ref -1); Sat, 11 Mar 2023 07:45:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Mar 2023 07:44:35 +0000 Original-Received: from localhost ([127.0.0.1]:56463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1patu6-0004lj-Qn for submit@debbugs.gnu.org; Sat, 11 Mar 2023 02:44:35 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1patu5-0004lb-I9 for submit@debbugs.gnu.org; Sat, 11 Mar 2023 02:44:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1patu5-0000mW-8F for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:44:33 -0500 Original-Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1patu3-00035O-67 for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:44:32 -0500 Original-Received: by mail-ed1-x530.google.com with SMTP id o12so29549928edb.9 for ; Fri, 10 Mar 2023 23:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678520668; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=dhTjq4gIBZlp4GNb5aFo6/qhWy0ZLorhCF+8YkeL3Xg=; b=UvytrQvxMNeu9PbWCPEEZXHmoW5J/t9I4PVIc93OpJyodWWAXzLbTJdgXTrXkl7VFF 0NuqjWcxLJ/IDFwMjhj+onsoqlv1g73nV4O2WsbfLqu5tOpb6N2gmQEq0zyZy0LVCv37 /14gWxbVg1Pvrghn6SRPCRsmGkATeHlD4kTCPZ/cAgKBd/zsmVA1XIjzDgWAZrCqrb7Z Z0v2XP9KtwoCliu94KyLzQj1IWKIryOfLG1TTeW6s4tzEG4UQklocDuKo7eIWfzBVXnF XpXSjovnRXDG5cWEJ/oRaeMthTWi8+JP1AwZpU1j36IOQ/UdGeSc3KxLbZOQLSAzuobE xzjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678520668; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dhTjq4gIBZlp4GNb5aFo6/qhWy0ZLorhCF+8YkeL3Xg=; b=BBySMS5uEB2458ANg/0GF9wfyGu+E5XcD9vnP2SfEY0J/EnAGn5o/RhYXcUaPyNPfv STj3F4VOCQAlRnUpgYzm7bbY1RQuUojQVXHfHG3RGfM/gp8ub4EUOlDj6XSOq+VTjMjd JvJxObJm0ESvAFnt/zOI7chPMtKKgQHtGCpAyrhUDjjVLsMgfyoHWvqFPdBxawV4eA8K wtkwTF3IZ7sJgL6QFuEaEzcLKClwQ84gYPvPjafwd8RyKma+9O9jwl9PmdkgzIxKfSz0 sPK7+JM3ifusRPqky0aEtfOtYX8AtV4bH1O13YyjggPTtoJHJFrOE4tQKFY/egkPJ0ry wIMg== X-Gm-Message-State: AO0yUKXEK55mwgOFzkuJy13WoKiYYYXvSZ4mYCsRchpgtZ6gI04G92KV knBI/GPzCih9OaJfDa6P33czWy7DVTC+OQ== X-Google-Smtp-Source: AK7set/hjUl/t8WNRs1ZyF8eVFqtCcxmglSyNFlyZYZQQ21aQhJhAZWWtS9QEabgjkvge9bsgn3s6Q== X-Received: by 2002:aa7:c952:0:b0:4fa:a1a1:9e14 with SMTP id h18-20020aa7c952000000b004faa1a19e14mr393519edt.30.1678520668497; Fri, 10 Mar 2023 23:44:28 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id m5-20020a50d7c5000000b004c0057b478bsm853228edj.34.2023.03.10.23.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 23:44:28 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x530.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257758 Archived-At: Consider this example: --8<---------------cut here---------------start------------->8--- (require 'cl-lib) (defun f (map) (cl-letf (((map-elt map 'a) 1)) map)) (let ((map '(b 2))) (f map) map) => (b 2 a nil) (let ((map (make-hash-table))) (f map) (map-length map)) => 1 --8<---------------cut here---------------end--------------->8--- I would expect `f' to have no side effects, so get (b 2) and 0 respectively in the two examples. For comparison, plist-get as a place has no side-effect: --8<---------------cut here---------------start------------->8--- (defun g (map) (cl-letf (((plist-get map 'a) 1)) map)) (let ((map '(b 2))) (g map) map) (b 2) --8<---------------cut here---------------end--------------->8--- Of course it's usual to treat a nil entry and no entry as equivalent in Lisp, but this behavior can be a problem e.g. when constructing data to pass to other programs.