LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Mime-Version: 1.0 (Apple Message framework v928.1)
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Date: Thu, 11 Sep 2008 15:31:59 +0930
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Will Robertson <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Transfer-Encoding: 7bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (57 lines)
On 11/09/2008, at 2:52 PM, Joseph Wright wrote:
>
> To get something like a formalised system for modules in general, a
> simple list of modules would probably suffice.

Before I (or others) reply to those good suggestions, I'll re-post a  
suggestion made by Philip Lehman a while back (appended).

I quite like this idea. If it's made formal in the \DeclareExplPackage  
command, then it would be quite possible for CTAN to keep track of the  
prefixes chosen.

Will


Begin forwarded message:

> 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...

ATOM RSS1 RSS2