[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposal: directory-slash in library names
From: |
Tom Breton (Tehom) |
Subject: |
Proposal: directory-slash in library names |
Date: |
Wed, 6 Jan 2010 18:08:15 -0500 |
User-agent: |
SquirrelMail/1.4.19 |
***** Rationale
Emacs library names are restricted to a flat-level namespace. There
is no explicit support of submodules.
This limitation is usually worked around by using the format
COMMONPREFIX-LIBRARY. This is used by packages such as org, calc, cl,
and sometimes by non-package arrangements such as pcomplete, which
standardizes the prefix "pcmpl-" for its clients. Compare it to
Perl's easy deployment of constructions like
"AI::ExpertSystem::Advanced::KnowledgeDB::Base"
This workaround has disadvantages, including:
* It's effectively limited to 2 components, since names must not
clash on filesystems that limit filenames to 8.3 format.
* Those components have to be fairly short.
* Being short, those components are less readable than they could
be.
* Because they have so few characters to work with, library authors
have to unduly concern themselves with possible nameclashes.
* It lacks a natural way of naming support files (such as tests) in
relation to the libraries they support.
* Module names contain less information about the module's role than
they could.
***** Proposal
This is real easy, almost a no-op. I'm not proposing any new code.
I'm not proposing that any existing libraries be rewritten or renamed.
I'm only proposing:
* to give the official OK to directory-slash in library names, for
example:
: dir1/dir2/feature
* for the directory-slash to be treated as it is in filenames
(specifically, internally canonized filenames). Eg the example
would mean to look for "dir1" anywhere in load-path, for "dir2"
within that, and for "feature.elc" or "feature.el" there, using the
first successful match.
***** It already seems to work
I experimented and it already does the right thing on GNU/Linux. One
can write:
: (require 'dir1/dir2/feature)
and emacs will load-file "feature.el" from "dir1/dir2" beneath any
directory in load-path.
I cannot test it on other systems, but from the C source, it seems as
though it will work on any system that `expand-file-name' works on.
That apparently translates dir separators, eg it calls
CORRECT_DIR_SEPS for WIN_NT.
Tom Breton (Tehom)
- Proposal: directory-slash in library names,
Tom Breton (Tehom) <=