LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Fri, 2 Jan 2009 09:31:02 +0000
text/plain (103 lines)
Will Robertson wrote:

>> On the other hand, there is a problem with contributed packages in
>> LaTeX2e. A package that is written by X, would include a command where
>> its name is already used in the other package and if the user uses
>> these two packages, then he will be experienceing such problems. Is
>> there any plan that in LaTeX3, we can control contributed packages to
>> avoid such problems?
> There is a more formal mechanism to name package variables/functions
> according to a standard naming scheme.
> For example, in the expl3 code the functions are split into separate
> modules, each which takes a standard prefix:
>    \clist_map_inline:nn
>    \bool_if:nTF
>    \int_abs:n
> and so on. New packages/modules will take their own prefix in the same
> way that LaTeX package authors use things like \zf@ as a prefix to
> separate their internal functions and avoid clashes. Without namespacing
> in TeX, this is the best we can do -- the problem will never be
> eliminated but it shouldn't be much of a problem. Even now I find it's
> very rare to run into problems.

For internal macro names, this is true but the issue is more real for
user-space macros.  Some thoughts:

- It's likely that LaTeX3 will cover a lot of what is currently done by
packages as part of the kernel.  The kernel namespace will therefore be
much bigger, but should reduce the number of packages needed (at least
in the short term).

- Clearer separation of user and internal macros should help here.
Several packages currently provide programming functions with user-space
names. I'd hope that the more formal structure in LaTeX3 should avoid this.

- The ideas set out in template (and also some kind of keyval support)
should mean that a lot more variables are set using optional
arguments/altered macro functions rather than by new macro names.  This
should help.

- The vast number of LaTeX2e packages and functions should give a much
clearer idea for LaTeX3 developers of what is needed.  So I'd expect
that a lot of LaTeX3 packages will cover what is done by several LaTeX2e
ones. There are also a lot of clues on things to avoid (for example,
when I write siunitx for LaTeX3, I won't use \newunit as it is also used
by biblatex: I'm thinking of \DeclareUnit or \siunitx_unit_new).

With all of that said, I think that there are some things to think about:

1) How are module names/prefixes managed?
2) How do you ensure that user macros clash less/not at all?

I'd suggest that a more formal system for registering module and
function names might be useful.  For modules, a simple "I'm developing
module xxx, which is reserving module prefix yyy" form, with a
searchable interface would be useful.  For user functions, it would also
be useful to do something like that.  I wonder about some kind of .mod
"registration" file (perhaps working with the CTAN people):

\module_new {
  name  =  ???,
  prefix = ???,
  owner = ???,
  e-mail = ???,
  webpage = ???,

\module_user_functions {module-name} {function1,function2,function3}

With this in a separate file, it would be relatively easy to parse it
with a web server and build a database of the information for
developers.  You would also do something like:

\module_description_load {module-name}

at the beginning of a module.  This would read the file outlined above
and would then give a useful error if there was a clash:

"The module <clashing-module> has reserved the functions names:


which are also defined by <current-module>.  Loading of <current-module>
has been aborted.  Please report this to the module maintainers:

<current-module>	<e-mail>
<clashing-module>	<e-mail>

and also the LaTeX3 database team:

[log in to unmask]"

Something similar would also be appropriate for the internal module
prefix names.

I think with the more formalised programming system in LaTeX3 you are
likely to have less one or two line packages, and more "serious"
programming.  So I think the above mechanism is workable.
Joseph Wright