[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: Fri, 1 May 2020 20:05:22 +0200

I'm not completely sold on its contents for the core, however: a lot of
it looks like a compatibility layer for Clojure's familiarity's sake,
with very thin wrappers (which basically just add the cost of function

1. s-prepend/s-append: trivially replaced by 'concat'.

I'd like to get more insights about this point. I think it's a point that comes back fairly often here, and I'm not sure I fully understand why.

I'll try to explain my side first so you see where I'm coming from. So, I guess a lot of s.el users think it's a massive improvement over what emacs has to offer reguarding string manipulations. This is visible in issues like https://github.com/magnars/s.el/issues/88. I never coded with clojure, but my argument for these helpers is that in code we do string manipulations all the time, they are trivial to write, so why not have trivial helpers. I understand there's a limit to such helpers because you could write thousands of them, so good taste should be used to introduce "the minimal set". I usually don't care about these extra function calls, what matters more to me is how beautiful the code looks and how readable it is. If performance becomes a concern, then I usually first improve the algorithm or switch to C++, and only at last measure do I resort to these "micro optimisations" like avoiding a function call. Because string manipulation is so trivial, I'd like them to be grouped together so they are easy to find. In other languages I can usually go to one page and have the list of all strings related functions. In Emacs the manual at https://www.gnu.org/software/emacs/manual/html_node/elisp/Strings-and-Characters.html while helpful makes it hard to "read it all" and find what you are looking for. For example I couldn't find concat on that page.

From your side, I understand that your definition of the minimal set is much thiner, and maybe what would help is to give the complete list of the functions you find superfluous and why (list at https://github.com/magnars/s.el so far you mention `s-prepend` and `s-append`). For example I'd disagree if you said `s-left` and `s-right` are not useful to import because it can be done with `substring`.


reply via email to

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