LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

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

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

Print Reply
Joseph Wright <[log in to unmask]>
Sat, 8 Jan 2011 20:44:49 +0000
text/plain (31 lines)
On 08/01/2011 07:25, Bruno Le Floch wrote:
> PS: Also, a small crazy idea (I see no practical application for that):
> In LaTeX3, we can generate variants of macros with different types 
> of arguments (using \cs_generate_variant:Nn). Could/should the 
> same thing be done at the layer above? In other words, should it be 
> possible to take a DocumentCommand, and change the delimiters, or 
> change an argument from being optional to being mandatory, or from 
> being mandatory to being  optional with default, ...?

Not really. While the concept is still very much 'a work in progress',
in general it seems clear that as far as possible you should have

\NewDocumentCommand \foo { ... } {
  \internal_function:nnn ....

i.e. document commands should really not do much themselves, but should
pass data on to internal functions. Thus document commands define the
user syntax for some particular implementation, but for variants you'd do

\NewDocumentCommand \fooa { ... } {
  \internal_function:nnn ....
\NewDocumentCommand \foob { ... } {
  \internal_function:nnn +++

with different argument mappings.
Joseph Wright