[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
library prefixes (versus other name prefixes)
From: |
Drew Adams |
Subject: |
library prefixes (versus other name prefixes) |
Date: |
Sat, 2 May 2020 12:35:59 -0700 (PDT) |
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?
- library prefixes (versus other name prefixes),
Drew Adams <=