* library prefixes (versus other name prefixes)
@ 2020-05-02 19:35 Drew Adams
2020-05-03 15:07 ` Adam Porter
0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2020-05-02 19:35 UTC (permalink / raw)
To: emacs-devel
Some of the discussion in threads "handling many
matches", "Imports / inclusion of s.el into Emacs",
and now "Add some aliases for re-related functions"
considers the use of a thing-type name as prefix
for function, var, etc. names.
For example, it's proposed to add aliases that
use prefix `re-' for regexp-related functions.
Currently, I see only these functions with that
prefix:
re-builder (command)
re-search-backward (command)
re-search-backward-lax-whitespace
re-search-forward (command)
re-search-forward-lax-whitespace
I asked myself the question, "What if someone
wanted to add a library/package that uses
prefix `re-'? Already taken, in effect, and
not for a library. Too bad.
How do we tell a library prefix from another
kind of prefix, including one that refers to
a type of thing returned or accepted as arg?
We can't, on the face of it.
So I wonder if it isn't time to reconsider the
convention of ending a library prefix with `-'.
I know that some libraries out there do use
a different char, in particular `/'. Should
we change to that? (I'm thinking maybe yes.)
If so, should we rename existing library
prefixes to respect that new convention?
(I'd say no.)
___
What about this proposal:
1. Change the library-prefix convention to use
`/' instead of `-'.
So instead of `mylib-foo' the name would be
`mylib/foo'.
2. Say that the prefix should have at least 2
chars, besides the `/'.
So `s/foo' and `/foo' wouldn't conform.
3. "Internal" names would still use `-', after
the prefix.
So instead of `mylib--foo' the name would
be `mylib/-foo'.
What would be some pros & cons in making such a change?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: library prefixes (versus other name prefixes)
2020-05-02 19:35 library prefixes (versus other name prefixes) Drew Adams
@ 2020-05-03 15:07 ` Adam Porter
0 siblings, 0 replies; 2+ messages in thread
From: Adam Porter @ 2020-05-03 15:07 UTC (permalink / raw)
To: emacs-devel
If I may offer a perspective from "MELPA land" (though I am not MELPA,
just a contributor):
MELPA has not always required that submitted packages strictly adhere to
the Elisp manual's conventions, so some older packages do use a slash as
a prefix separator.
New packages are frequently submitted which use a slash separator. Now,
MELPA requires them to replace the slash with a hyphen, as the Elisp
manual recommends. Sometimes the package authors are very reluctant to
do so.
Some built-in Emacs packages also use a slash separator, like pcomplete
(although it seems to use it only for generated completion functions,
not library functions).
Some MELPA packages also use a colon as a separator, like Hydra
(although, like pcomplete, it seems to use it only for generated Hydra
functions).
In my own non-MELPA code, I use a slash separator. For me, it's more
visually distinctive than a hyphen and makes it easier to discern the
prefix part of the symbol.
So, I would be glad if the official Elisp conventions allowed a slash
separator, and I think many other Elisp package authors would as well.
This topic frequently comes up in discussion on reddit.com/r/emacs,
which is read by many users and package authors, so I've linked this
thread there:
https://old.reddit.com/r/emacs/comments/gcrwic/the_symbolprefixseparatormustbeahyphen_topic/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-03 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-02 19:35 library prefixes (versus other name prefixes) Drew Adams
2020-05-03 15:07 ` Adam Porter
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).