[Top][All Lists]

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

Re: discoveribility [Re: dash.el [was: Re: Imports / inclusion of s.el i

From: Philippe Vaucher
Subject: Re: discoveribility [Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs]]
Date: Sat, 9 May 2020 23:36:17 +0200

>    > s.el has little point, it is thin wrappers around Emacs Lisp
>    > functions, and it has been explained why it isn't suitable (as is).
>    To me it has the point of discoverability. I understand it's not
>    your position. I think both positions are reasonable.
> How does it make it more discoverable?

It looks like you missed the previous discussion about namespaces.

I think it's simpler if you read the following posts and then continue
reading here:

Why I'd like namespace for discoverabilty (C-h f):
Proposed aliases:
Summary of counter-arguments:

So to still reply to your one-liner: because all the function using
the same prefix makes it easy for me to quickly get *the exact list*
of functions for a topic using "C-h f" or other tools. In the vast
majority of languages some sort of grouping is done, e.g
https://ruby-doc.org/core-2.6/String.html but also Python, Clojure,
Haskell, etc.

> E.g., how is s-ends-with? more discoverable than string-suffix-p? When
> Emacs Lisp custom is to use -p for predicates, and to use the words
> suffix/prefix.  To take a trivial example.
> I understand that from the point of view of a different language
> s-ends-with? might make more sense since you're assuming that it will
> do the same as in Ruby since they have the same name.  And you will
> also assume that since one such function exists, there will be more
> similar functions that remind you of your previous experience in Ruby.
> But we should view it from the lense of an Emacs Lisp hacker, where
> discovering that one function for predicates is named with -p and some
> with ? will be a big mess.  Where sometimes one uses ends/starts
> instead of suffix/prefix.

All true but "offtopic" ;-)

>    Emacs's `capitalize` is usually absent from other languages, but when
>    it exists it's named titleize (Ruby).
> If you come from Ruby and assume that Emacs lisp is Ruby you will trip
> -- but they are not the same languages, one cannot expect them to
> behave the same.

Well yes I kinda expected Emacs to give us high order programming in a
consistent and organized manner. If you look at the popularity of
dash/s.el/f.el we are many wanting that.

>    I can see how wanting to rename capitalize to titleize makes people
>    cry from the Emacs lisp perspective and how it feels silly from the
>    "rest of the languages" perspective (that you have "titleize" but not
>    "capitalize").
> I think it makes people cry from an English language perspective
> too... One is an actual word, the other isn't!
> It also is misleading, since it will lower case all words follow the
> first one, where in an actual title one would expect things like
> subjects to be capitalize.  E.g, the chapter title "Strings and
> Characters" -- we do not want it to be "Strings and characters"!

Well as I said already in every language "capitalize" means first
character uppercase all the rest lowercase:


Emacs lisp is the only language that names "capitalize" what is named
"titleize" in other languages (when it exists) and not have the
"capitalize" equivalent of other languages.

>    Also personnaly when I want to know how to do something in plain Emacs
>    lisp I go & look at the source of dash functions, so in a sense it
>    improves "plain Emacs lisp" discoverability for me.
> Why would you go to dash.el to understand what Emacs does?  Isn't it
> just C-h f away to understand what any Emacs function is doing?  How
> is the Emacs manual, or Emacs Lisp manuals not serving this purpose
> for you?  Or any of the other features that Emacs provides to look up
> things.

If you know what to look for yes, with dash I can just regexp search
for "^-.*\?" and find the *exact list* of all the predicates that
works on a list. Searching the equivalent "*-p" in emacs gives me many
wrong predicates not about list (note that all the dash `?` function
have aliases named `-p` to be consistent with emacs, so you can use
`-any-p` instead of `-any?`).

reply via email to

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