Here's a suggestion for a poor man's "namespace" protection with
Latex. I figured I'd post it here before filing it as a feature
suggestion.

When writing a class or a package, it's not feasible to use
\newcommand all over the place. What most authors do is pick a prefix
and hope for the best. So the foobar package might use internal
macros like \fb@foo and \fb@bar while the barfoo package would use
\bf@foo etc. If there is a conflict, things will likely go wrong in
ways which are not transparent to the end-user.

How about having something like the following in the kernel:

\def\ReserveNamespace#1#2{%
\@ifundefined{ltx@resrvd@#1}
{\@namedef{ltx@resrvd@#1}{#2}}
{\@latex@error
{Namespace #1' already reserved by \@nameuse{ltx@resrvd@#1}'}
{The namespace #1', claimed by #2', has already
been reserved by \@nameuse{ltx@[log in to unmask]
\ReserveNamespace{ltx}{LaTeX}

This will permit class/package authors do do the following:

\ReserveNamespace{FB}{foobar}
\def\FB@foo{...}
\newif\ifFB@bar
\newcount\FB@cnt

...giving them namespace protection comparable to \newcommand, but in
a much more efficient and general way. It may also be worthwhile to
integrate that into \ProvidesClass and \ProvidesPackage:

\ProvidesPackage[FB]{foobar}[2006/03/05 v1.0 The foobar package]
\def\FB@foo{...}
\newif\ifFB@bar
\newcount\FB@cnt

That's probably only relevant for Latex 3...

--
Philipp Lehman <[log in to unmask]>
`