Whenever Emacs Hackers come together to discuss what the most urgently needed enhancements to Emacs are, some sort of module system is always mentioned. In terms of Common Lisp, the idea is to add a (Common Lisp) package system to Elisp1.
It seems like a no-brainer. The current system seems to be a mess where we're forced to add the module name to each package symbol2 so they don't leak into other modules. It's something that I never really questioned until I read RMS's explanation for why Elisp doesn't implement name spaces.
RMS takes a lesson from his efforts in implementing the Common Lisp package system back in the 1980's. He says that although the idea sounds nice, it doesn't really do what you need it to do: you almost always have to add the module name to each exported symbol anyway so the extra complexity in the language isn't worth it. He decided that for Emacs you might as well just add the package name to the symbol and do away with all the name space machinery.
When I first read that, I thought it was obviously wrong. On further reflection, I think that RMS had it right. Suppose you have two Emacs packages that implement an
insert-results function. If you want to call
insert-results, you clearly you have to specify which function to use; you have to specify the package name. But how do you know whether there's another package that exports the same function name? Maybe you're not loading it today but will tomorrow or the next day. Just to be sure, you better specify the package name every time.
See what happens? You can either specify
some-package-insert-results. It's the same amount of work for the user either way but in one case the package writer has to deal with the name space machinery. Yes, name spaces do protect internal variables and functions but maybe Malabarba's names package is good enough for that.
Of course there are many intermediate modules systems that might fit well3, but it's clear to me that the Common Lisp package system is not what we need. What do you think?
The Common Lisp package system implements name spaces. This is different from the Emacs package system, which deals with obtaining and loading 3rd party packages.
Maybe that within a package source file all the symbols are accessible without the package name, but externally the package name has to be specified.