unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* removing flatten-list (alias for new flatten-tree function)
@ 2018-12-17 18:40 Paul Eggert
  2018-12-17 19:00 ` Alex Branham
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2018-12-17 18:40 UTC (permalink / raw)
  To: Alex Branham, Basil L. Contovounesios
  Cc: Michael Albinus, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

Thanks for writing the new flatten-tree function and cleaning up 
existing duplicate functions. I tweaked its performance a bit and 
cleaned up some more duplicates. While doing that I found that I was 
confused by the existence of the just-added alias 'flatten-list', and I 
propose removing it as per the attached patch. I think people who want 
to find and use the new 'flatten-tree' function will typically be better 
served if it has just one name that fits in with existing Emacs Lisp 
functions like 'copy-tree', as opposed to also having a name that is a 
misnomer.


[-- Attachment #2: 0001-lisp-subr.el-flatten-list-Remove.patch --]
[-- Type: text/x-patch, Size: 1243 bytes --]

From b1c894069483adf39b5f4d1f0cdd8f1aeecb87e9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 17 Dec 2018 10:28:14 -0800
Subject: [PATCH] * lisp/subr.el (flatten-list): Remove.

---
 etc/NEWS     | 6 ++----
 lisp/subr.el | 4 ----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 327276eef9..9c6401d204 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1360,10 +1360,8 @@ are implemented in C using the Jansson library.
 'ring-resize' can be used to grow or shrink a ring.
 
 +++
-** New function 'flatten-tree'.
-'flatten-list' is provided as an alias. These functions take a tree
-and 'flatten' it such that the result is a list of all the terminal
-nodes.
+** New function 'flatten-tree' returns a "flattened" copy of a tree,
+such that the result is a list of all the terminal nodes.
 
 ** Mailcap
 
diff --git a/lisp/subr.el b/lisp/subr.el
index c5004a539b..0bb04d5e0a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5466,8 +5466,4 @@ flatten-tree
     (if tree (push tree elems))
     (nreverse elems)))
 
-;; Technically, `flatten-list' is a misnomer, but we provide it here
-;; for discoverability:
-(defalias 'flatten-list 'flatten-tree)
-
 ;;; subr.el ends here
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: removing flatten-list (alias for new flatten-tree function)
  2018-12-17 18:40 removing flatten-list (alias for new flatten-tree function) Paul Eggert
@ 2018-12-17 19:00 ` Alex Branham
  2018-12-17 20:23   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Branham @ 2018-12-17 19:00 UTC (permalink / raw)
  To: Paul Eggert
  Cc: Basil L. Contovounesios, Michael Albinus,
	Emacs development discussions


On Mon 17 Dec 2018 at 12:40, Paul Eggert <eggert@cs.ucla.edu> wrote:

> Thanks for writing the new flatten-tree function and cleaning up
> existing duplicate functions. I tweaked its performance a bit and
> cleaned up some more duplicates.

Thanks!

> While doing that I found that I was confused by the existence of the
> just-added alias 'flatten-list', and I propose removing it as per the
> attached patch. I think people who want to find and use the new
> 'flatten-tree' function will typically be better served if it has just
> one name that fits in with existing Emacs Lisp functions like
> 'copy-tree', as opposed to also having a name that is a misnomer.

The reason I included `flatten-list' was that the existing
implementations (both inside and outside of Emacs) were nearly all
called foo-flatten-list or similar. I thought it would perhaps be easier
for people to find `flatten-list' than `flatten-tree'. I don't have a
really strong opinion about this, though.

Alex



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: removing flatten-list (alias for new flatten-tree function)
  2018-12-17 19:00 ` Alex Branham
@ 2018-12-17 20:23   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2018-12-17 20:23 UTC (permalink / raw)
  To: Alex Branham, Paul Eggert
  Cc: Basil L. Contovounesios, Michael Albinus,
	Emacs development discussions

> > While doing that I found that I was confused by the existence of the
> > just-added alias 'flatten-list', and I propose removing it as per the
> > attached patch. I think people who want to find and use the new
> > 'flatten-tree' function will typically be better served if it has
> > just one name that fits in with existing Emacs Lisp functions like
> > 'copy-tree', as opposed to also having a name that is a misnomer.
> 
> The reason I included `flatten-list' was that the existing
> implementations (both inside and outside of Emacs) were nearly all
> called foo-flatten-list or similar. I thought it would perhaps be
> easier for people to find `flatten-list' than `flatten-tree'. I
> don't have a really strong opinion about this, though.

Yes.  I don't know whether an alias is needed, but this
should be pointed out in the doc, because Elisp is part
of the history of Lisp.  Flattening a (Lisp) list has
pretty much always meant flattening it throughout. 

If you want to use an alias that mentions "list", consider
`deep-flatten-list'.

"Deep" usually conveys recursively performing some action
at all levels.  And it's understood by most developers,
using most languages.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-17 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17 18:40 removing flatten-list (alias for new flatten-tree function) Paul Eggert
2018-12-17 19:00 ` Alex Branham
2018-12-17 20:23   ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).