[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Imports / inclusion of s.el into Emacs

From: Philippe Vaucher
Subject: Re: Imports / inclusion of s.el into Emacs
Date: Sat, 2 May 2020 22:30:49 +0200

In Haskell, do you name every function with a
prefix that advertises the type of its return
value or one of its main arguments?  No, of course
not.  How do you find functions that return or use
a value of a given type?  You check signatures
or doc.

Except if I'm missing somethign Haskell also groups related functions together: https://hackage.haskell.org/package/strings-1.1/docs/Data-Strings.html

As for "alist", "ass(q|oc)", and the like: each
such choice has its drawbacks.  But yes, some name
consistency can help, in general.  But no, because
history.  And no, because different uses/contexts.

The discussion was motivated by considering new
users, in particular.  Well then, what does a new
user look for, when it comes to alists?  Does s?he
know the term "alist"?  Or is the thought about
"association"? "key-value"? "pair"? "relation"?
"attribute-value"? "property-value"?

It has already been said that alist was a bad example. Consider process or regexp instead.

Consider `C-h f alist', with substring matching.
In my current session I get 156 candidates, all
of which are relevant to alists.  Great.

If I match `ass' instead, I get 235 candidates,
many of which are about alists, but many of which
are not.  If I then chip away from those matches
the matches for `class' and `pass', I get only 51
matches, of which 34 are about alists.

If I use `C-h d alist' I find 560 functions
whose doc mentions "alist".
`C-h d association list' finds 56 functions.
`C-h d assoc' finds 52 functions.

When I see this it only confuses me. Sure those are great tools to find things in a broad sense, but there are so much noise that you have to filter. The only relevant functions I'd like to find are:

assoc, rassoc, assq, alist-get, rassq, assoc-default, copy-alist, assq-delete-all, assoc-delete-all, rassq-delete-all

Anything else listed there is noise IMHO, except if searching in a broad scope.

Finally, the habit of assuming that functions
should be grouped only by argument or return
type, either in terms of name or doc, is not
a guide.  API doc (e.g. JavaDoc) does have its
uses.  And it's especially useful, perhaps
even necessary, for certain kinds of languages
(e.g. OOP).  But it's certainly not the be-all
and end-all.

Agreed. Still I think there is a lot of room for improvement, without going "all the way".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]