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