[Top][All Lists]

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

Re: Add some aliases for re-related functions

From: Alan Mackenzie
Subject: Re: Add some aliases for re-related functions
Date: Sun, 3 May 2020 09:43:42 +0000

Hello, Philippe.

On Sat, May 02, 2020 at 23:51:13 +0200, Philippe Vaucher wrote:
> > > Just to be clear, you don't like aliases because if they were to be used
> > > you'd hate reading code using them, correct?

> > (snip)

> > > I mean you agree they won't take away your ability to use the old names?

> > This old one!  I disagree with you entirely, here.  I debug other
> > people's code as well as my own.  I'd have to put up with
> > "re-match-after-point" and friends, thus losing the ability to "use" the
> > current names.

> I think you misunderstood me there. Literally one sentence ago I said that
> you don't like aliases because you'd dislike reading code using them, so I
> understood your concern. I also find your definition of "use" a bit
> surprising, but ok I note that for you "use" means "write code with that
> name as well as read code with that name". In my definition it just means
> "write code with that name".

It's good to understand what we mean by simple words like "use".  It
seemed to me like you were regarding the reading of code as a minor
unimportant thing.  I think reading code (including all the things which
require it, such as debugging) is the most important thing we do with
code, bar executing it.

So, if by "use", you mean just "writing", I'd say that's not of the
highest importance.

> > And there's a good chance some "helpful" person will decide it's time to
> > purge the traditional names from all code, including my code.

> That's indeed a valid concern. That said at the current pace of how things
> goes on that topic, I think even if *some* things were to change your code
> would still be untouched for at least 20 years :-)

The point is that this proposal is so disruptive that ALL code will have
to change.  And all the documentation.

> > Anyhow, why not look at existing examples from history?

> > On 1991-07-25, Jim Blandy introduced the alias
> > `search-forward-regexp' for `re-search-forward'.  Why?  Lost in the
> > mists of time.  Possibly for the same reasons people are advancing
> > now - make all the search functions begin with "search-" for supposed
> > easier searching (of their names).  In master we currently have 3534
> > occurences of re-search-forward and 134 of search-forward-regexp.
> > Would anybody here argue that Emacs is the better for these 134
> > alternatively named function calls?  I'd say it was a mistake, and
> > there is nothing positive to offset the confusion.

> Interesting. Is one of the alias deprecated now? What prevents us from
> massively rename every search-forward-regexp to re-search-forward?

Nothing.  Just we can't get rid of the alias because it will be being
used by lots of external code.  Aliases are a lot easier to introduce
than to get rid of.

> I understand it's not your point but I don't understand why this isn't
> fixed yet.

> > Or `delete-backward-char' and its alias `backward-delete-char'.  We have,
> > respectively, 5 and 36 uses.  To me, this is just confusion, whatever the
> > original reason was for these aliases.

> Same question as above.

Same answer.

> > I say we shouldn't add to such confusion.

> That's an interesting point. At the same time it gives me this impression
> that following this logic everything is written in stone forever because
> any change would be confusing.

Lots of things change continually in Emacs.  Mostly, they are sensible
amendments which are restricted in scope, and well tried out before hand.

This proposal, the wholesale renaming of function names, for what purpose
seems to have been forgotten, will overturn decades of history.  Yes,
`looking-at' should stay looking-at forever, because it is an established
name and is a good name.

It is not that the proposed change would be "confusing".  It is that the
change would be bad.  Of all the things we do with source code, reading
it is the most important.  The change would render Emacs less readable.

The rationale for this change has got lost in the flurry of bikeshedding.
Eli, early on, tried to explore this rationale and come up with less
disruptive ways of achieving it.  It seems to me entirely possible that
somebody decided they wanted to rename Emacs functions, and came up with
a justification for it, rather than the other way around.

`looking-at' is a far better name than `re-matched-after-point'.  Let's
just stick with it.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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