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#62068: 29.0.60; map-elt and map-insert for nested structures Date: Sat, 11 Mar 2023 08:51:33 +0100 Message-ID: <87356bvi7u.fsf@gmail.com> References: <875ybafig1.fsf@gmail.com> <87zg8lh09g.fsf@web.de> <87ilf99j6e.fsf@gmail.com> <87r0twt1js.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4877"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Basil L. Contovounesios" , Nicolas Petton , 62068@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 11 08:52:17 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 1pau1Y-000186-UL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Mar 2023 08:52:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pau1P-0002RP-N7; Sat, 11 Mar 2023 02:52:07 -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 1pau1N-0002RC-B9 for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:52:05 -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 1pau1K-0004PO-GT for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:52:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pau1K-00052k-6Z for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:52: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:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62068 X-GNU-PR-Package: emacs Original-Received: via spool by 62068-submit@debbugs.gnu.org id=B62068.167852110319354 (code B ref 62068); Sat, 11 Mar 2023 07:52:02 +0000 Original-Received: (at 62068) by debbugs.gnu.org; 11 Mar 2023 07:51:43 +0000 Original-Received: from localhost ([127.0.0.1]:56473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pau11-000526-4c for submit@debbugs.gnu.org; Sat, 11 Mar 2023 02:51:43 -0500 Original-Received: from mail-ed1-f54.google.com ([209.85.208.54]:37734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pau0y-00051q-Uh for 62068@debbugs.gnu.org; Sat, 11 Mar 2023 02:51:42 -0500 Original-Received: by mail-ed1-f54.google.com with SMTP id j11so29598950edq.4 for <62068@debbugs.gnu.org>; Fri, 10 Mar 2023 23:51:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678521095; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=RF7LSYL3R8OL6rKseLDFqcs5A/MFtECXTVLl8GZP89E=; b=V/bZ0ekg5466pNJXp5JVQgweLpB/p/MdNOkSbYlqI1sp8nzHyUHczSgH3dANLhz3LL 2lQB3oMUR7TVgTMARyaZN02ZU92wmi0/36Fwzv4FeAhyvW5BuH6jYxg0IyY638ICU3hb MZbbZc0Cmh0OjvNLDUdGd5DQHsvJpcnCHGMG2HLRVcuvZDpnjvDf4CSHsDN+myQJhetX 5BIbTobrMlIBFHkjrmIN+HoemVfktdyb/Nrc38SwfnEYDQ7AKsMKjhuuoGC7Iq1qZXvH DurNDQBb5RTcP0YqoLpI4QRgxpnppHTj63oRHfzU7evjAVO0A7VLwd2fm3uhXyPyn0iy LC9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678521095; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RF7LSYL3R8OL6rKseLDFqcs5A/MFtECXTVLl8GZP89E=; b=dW54Oz/eq9DPbXwLIjEzlR0xtm4tKXxz5c8pSipKrbIR48epq8PsfBfeRtQfsoN2Hb YtsAO9W0xKOVcHnURy1LTPFcSUt94gf0TwEiSRN+zA3KEhu2SfFcglKhcatNZmfsWe5X wCRsroWAWs8yCNCEJkdFCeeNPE3uwT+zc6jQgA8c8Qg0nMAPoWb6blWEkc1eFg/S44Kg NX+ISes4QfpHd/1HRXYzzPurQRzj2byV0CpWn4bq7/f2uZ/gIRc/WDdGrw8LfPMITRZ2 LYhNtMH8mOxX6rynImoSjIp9kcRdj1AuaBPR0x5V+wfbqBy2KEfu4cniaRDQCpijNEmC ay7Q== X-Gm-Message-State: AO0yUKWz0I8a31/5EJfyu4ayG9pMda+hxfS27vPdq4e8XpBbJK0Pma0c P6CskxZ0AGxC5rUC323Cp8o= X-Google-Smtp-Source: AK7set85bqxO0ds7uGjJ25Qz+BR41ofrLwpt4v54UVqP/XogwAZQ3n8ZiqaeeWxTYX+4AO1Ka/V2og== X-Received: by 2002:a05:6402:654:b0:49e:1f0e:e209 with SMTP id u20-20020a056402065400b0049e1f0ee209mr5241732edx.10.1678521094978; Fri, 10 Mar 2023 23:51:34 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id d30-20020a50f69e000000b004bcee7838c8sm853471edn.75.2023.03.10.23.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 23:51:34 -0800 (PST) In-Reply-To: <87r0twt1js.fsf@web.de> (Michael Heerdegen's message of "Sat, 11 Mar 2023 04:22:15 +0100") 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:257760 Archived-At: On Sat, 11 Mar 2023 at 04:22, Michael Heerdegen wrote: > Augusto Stoffel writes: > >> How did I miss that? In any case the more interesting bit is the other >> function, which should then be renamed to `map-nested-insert'. > > Is that something one will really need often (honest question, I'm > really curious)? I think it's very useful when you need it :-). Actually, I wouldn't use map-elt in any code, because I always know what type I'm dealing with. I would just turn to this library for special maneuvers that the basic API doesn't offer. > If yes, I wonder if we should make it work as a > generalized variable. Maybe, but that's a separate story. First and most importantly, in my opinion, the library should work right on values (as opposed to places). >> Now, `map-nested-elt' has an inconsistency regarding the DEFAULT >> argument which needs to be fixed. >> >> (map-nested-elt '(a nil) '(a) 1) >> 1 >> (map-nested-elt '((a . nil)) '(a) 1) >> 1 >> etc. >> >> While in the other hand: >> (map-elt '(a nil) 'a 1) >> nil >> (map-elt '((a . nil)) 'a 1) >> nil >> etc. >> [...] > > That's a good point indeed. However, `map-nested-elt' exists since the > beginning of the library in 2015, so it could be that existing code > relies on the behavior (maybe that's why you wanted to add a new > function?). (No, the reason was just pure oversight. Maybe "elt" is a weird word? Why isn't it `map-get' and `map-nested-get'?) > But it's a terrible inconsistency. There are more consistency issues in this library, see bug#62067 and bug#62117. Emacs has its quirks and one of the selling points of map.el is to be a more consistent layer on top of the basic APIs, so I'd say this need to be fixed.