From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#34708: alist-get has unclear documentation Date: Tue, 12 Mar 2019 07:53:13 -0700 (PDT) Message-ID: References: <87wolhr5k6.fsf@web.de> <87y35xdu4w.fsf@web.de> <87mumcdu7f.fsf@web.de> <875zsyhakx.fsf@ericabrahamsen.net> <87fts2h9we.fsf@web.de> <871s3mh85d.fsf@ericabrahamsen.net> <874l8iebyz.fsf@web.de> <878sxui7bo.fsf@ericabrahamsen.net> <87va0xcxco.fsf@web.de> <87h8chey12.fsf@ericabrahamsen.net> <60367f47-c0b0-45b4-8ccf-169044400a75@default> <8736ntmsy3.fsf@web.de> <3af3b645-84e0-4208-be48-810e8cd2cfa8@default> <87a7i01bk0.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="217577"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eric Abrahamsen , 34708@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 12 15:54:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3inJ-000uTQ-Rn for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Mar 2019 15:54:17 +0100 Original-Received: from localhost ([127.0.0.1]:53878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3inI-0000Ze-N5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Mar 2019 10:54:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3in5-0000YF-Pr for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 10:54:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3in5-0005WS-4O for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 10:54:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55114) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3in4-0005W2-4t for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 10:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h3in4-00026A-2q for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 10:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Mar 2019 14:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34708 X-GNU-PR-Package: emacs Original-Received: via spool by 34708-submit@debbugs.gnu.org id=B34708.15524024048015 (code B ref 34708); Tue, 12 Mar 2019 14:54:02 +0000 Original-Received: (at 34708) by debbugs.gnu.org; 12 Mar 2019 14:53:24 +0000 Original-Received: from localhost ([127.0.0.1]:40425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3imQ-00025C-VC for submit@debbugs.gnu.org; Tue, 12 Mar 2019 10:53:24 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:51500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3imP-00024z-AW for 34708@debbugs.gnu.org; Tue, 12 Mar 2019 10:53:21 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2CEq6q6180299; Tue, 12 Mar 2019 14:53:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=NSUqAwfcaFrI+GqQCo1iJM9y3KmjwmhNL6Hdh6aN6/8=; b=caHF7kfUWQ6uNKl/E9TyXGKJng1wbZ/ap0U4bydfrtd5R5j9NrdGIWjSmnispZssePdW kA0ZYF/ViNuzGuOF3/ITV2yfzb0ldRg+N0OKjbxvFGv3DgimajymH46mhhs3gmFih9a1 gD0YiSdwwOFVknyVzbW9xAEZOjYl+6J5L/cHkM1IeghbhkyEregmhxx904bEf098Tzd4 SZy93sPwo/InUnFyZlbbjiREsTJW9mbaWf2/8O+DUVUJO31ydtozVEwT5p8kQUG4GbKd hHesMybHPr4e0Rx+bNiEBG+OrPK9+TcOh0uaET9RBP2xvWtiEqKUj3FAURsbXmEBP153 9g== Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2r44wu55ny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Mar 2019 14:53:15 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2CErFoI024502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Mar 2019 14:53:15 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2CErEIA029069; Tue, 12 Mar 2019 14:53:14 GMT In-Reply-To: <87a7i01bk0.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4810.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9193 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=970 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903120105 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156261 Archived-At: > > > (progn > > > (setq my-alist '((a . 1) (b . 2))) > > > (push (car my-alist) my-alist) > > > ;; my-alist =3D=3D> (#1=3D(a . 1) #1# (b . 2)) > > > (setf (alist-get 'a my-alist nil 'remove) nil)) > > > ;; my-alist =3D=3D> ((b . 2)) > > > > > > This is because the code uses delq to delete a found cons, and delq > > > removes all `eq' elements. > > > > > > Is it worth to document or change that? > > > > Sounds like an implementation/design artifact. If that will stay as > > part of the design then yes, I'd say such behavior needs to be > > documented. >=20 > BTW with a different viewpoint, when you use > (setcdr (assoc 'a my-alist) 17) >=20 > on the above degenerated alist you also change _both_ of the 'a > associations, so one could argue that the `alist-get' setter behaves > correctly when removing both: there are not two 'a associations in > MY-ALIST but the same one has just been added two times, so it's correct > to remove both of them. OK. Put it differently: it's worth documenting that updating an alist entry with `setf' is a "destructive" operation: it can change list structure. Dunno whether that is already said somewhere, but even if it is, a reminder wouldn't hurt.