emacs-devel
[Top][All Lists]
Advanced

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

RE: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification


From: Drew Adams
Subject: RE: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification
Date: Sat, 6 May 2017 09:30:46 -0700 (PDT)

> > +(defsubst string-trim-left (string &optional regexp)
> > +  "Trim STRING of leading whitespace matching REGEXP.
> > +
> > +REGEXP defaults to \"[ \t\n\r]+\"."
> > +  (if (string-match (concat "\\`" (or regexp "[ \t\n\r]+")) string)
> >       (replace-match "" t t string)
> >     string))
>
> Isn't there a way to do [...] that would work with defsubst?

IMHO, *none* of the defsubsts in subr-x.el should be there.
They should all be defuns.  (Currently, even their names are
inconsistent, some with `--' to indicate internal, most not.)

The code will be byte-compiled.  I see zero reason why these
functions should be defsubsts.  Instead of using a boatload
of defsubsts willy nilly, any defsubsts we put in the code
should be _strongly_ justified.  I don't see any justification
for these defsubsts.

It's not just because `defsubst' still exists that we should
use it casually (or even use it at all).  It is a precambrian
vestige, with little or no real use case.

Just one opinion.



reply via email to

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