emacs-devel
[Top][All Lists]
Advanced

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

Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorth


From: Phil Sainty
Subject: Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)
Date: Wed, 29 Sep 2021 01:49:59 +1300
User-agent: Orcon Webmail

On 2021-09-28 20:21, João Távora wrote:
So it sounds like you're arguing against namespaces in general,

Yes, I would vote against adding this to elisp.


and you're right, they have disadvantages, in any language.
But the advantages are immense.

Are they?  I don't see how they add anything at all of genuine worth.

(FWIW I'm sorry that this sounds harsh, as I'm certain that a lot of
effort has gone into this.  I just have really strong misgivings about
the feature.)

I agree that they make code a little nicer to write for the author
who knows what everything is.  I think this is an *extremely* minor
benefit which everyone can easily manage without (as they have done
for decades); and AFAICS it is the only benefit, and so I don't see
how it is worth all of the trouble that comes with it.

I firmly disagree with the notion that it makes code easier to read
for other people.  Other people actually now have to mentally account
for the fact that every symbol they see might not actually exist by
that name.  The manual even talked about the ability for different
people to use different shorthands for the same library, so a symbol
might actually have *many* names in the codebase.  This makes things
harder.

Allowing things to not be what they seem adds an additional cognitive
load to *everything* you look at, because everything has the potential
to not be what it seems, and so I think this makes codebases harder to
read and understand, generally.

Libraries that you might actually be familiar with can now appear in
an entirely unfamiliar guise, meaning that extra mental effort is
needed to figure out what is going on in situations which you would
otherwise have immediately understood.

It makes it harder for users to share code because, even if you know
which libraries are used, copied and pasted code can now be completely
broken without knowledge of the magic file-local variable.

From what I've seen it doesn't seem that the shorthand symbols even
exist (they are translated at read time), so if someone reads some
shorthand code and tries to look up the symbols they see, will they
find them?  If they C-h v and use TAB completion for the prefix they
are seeing in the code, will they see all the completions?  If so,
will that work in all buffers, in all locations?  If they get to the
help buffer and they try another look-up, will it then fail?  Or if
they simply have split windows and are reading code from the other
window?  What if different libraries specify the same shorthand for
different dependencies?  Can people only look up certain symbols
from certain places?

(I've just compiled from master to test some of this, and the answer
seems to be that it's impossible to look up the documentation for the
code you can actually see; unless you're in the buffer and asking
about the symbol at point, in which case it figures it out.  Again,
this is making things harder for the reader, not easier.  We have gone
from "if you can see it you can look it up" to "you can only look it
up if you are pointing directly at it, because it isn't what it says
it is".)


To organize complex problems utilizing many libraries, I cannot
imagine a decent language that does not have them.

How do namespaces help with that?  Without namespaces you still have
access to all of the same functionality from all of those many
libraries, to organise your complex problem.

Furthermore Emacs Lisp is not other languages, and Emacs is unusual.
It combines a very large amount of global state (which most programs
do not do) with dynamic binding (which most languages do not have).
Other languages are more likely to restrict the global state, and
share things in a far more limited manner.  In Emacs, global symbols
are used pervasively between libraries in a fashion that doesn't
happen in most software; and if the same symbol does not always have
the same name, I think that's a bad thing.

Surely "other languages have this" isn't a reason to add something to
elisp unless there is a clear net win to doing so, and all I'm seeing
are net losses.  What are the advantages that I'm not seeing which are
so immense that they make all the problems worthwhile?


-Phil

p.s. I know you wrote more, but this was already a long reply.
However, I don't think the informal "namespacing" of people's names
in a discussion is an analogue of the formal expressions needed by a
programming language; and I couldn't figure out what the "expressive
power" of shorthands might be.




reply via email to

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