Will Robertson skrev: > On 26/08/2009, at 8:39 PM, Lars Hellström wrote: > >> One remark without having looked at template-alt in detail is however >> that the signatures above feel as though they're on the wrong side of >> the =. That there are two arguments is a property of number-format; >> you need to know this when providing a value for this parameter. The >> :N signature rather seems like it applies to the implementation, the >> details of which are otherwise in the right hand side. > > > The current interface evolved from pgfkeys; I can't say I disagree with > you but I think a simpler scheme might involve a more complex parser. [snip] > Unless any of these jump out at you or you've got some more radical > ideas how to design this interface, I don't think I can see an > improvement over what template-alt currently uses. Well, why use a syntax that needs a separate parser at all? The main reason to have used a key=value syntax in the first place appears to have been the presence of defaults in the right hand side, but with your suggestion of separating the defaults from the basic declaration that loses most of its weight. What remains isn't such a good match to the basic 1-1 correspondence implied by a key=value syntax. Instead of \DeclareTemplate{caption}{lesssimple}{4}{ above-skip .set:N = \l_caption_above_skip , below-skip .set:N = \l_caption_below_skip , number-format .function:N = \caption_number_format:nn , nonumber-format .function:N = \caption_nonumber_format:nn , single-line-format .function:N = \caption_single_line_format:n , caption-font .function:N = \caption_set_font: , caption-hj-setup .instance:nN = {hj} \caption_hj_instance , } -- which is really some kind of pseudo-tabular key.declarationcommand=arguments syntax -- one can let the parameter declaration argument be a sequence of commands (in a sense, give it \declarationcommand{key}arguments syntax), like so: \DeclareTemplate{caption}{lesssimple}{4}{ \Variable {above-skip} {\l_caption_above_skip} \Variable {below-skip} {\l_caption_below_skip} \Function {number-format} {2}{\caption_number_format:nn} \Function {nonumber-format} {2}{\caption_nonumber_format:nn} \Function {single-line-format}{1}{\caption_single_line_format:n} \Function {caption-font} {0}{\caption_set_font:} \Instance {caption-hj-setup} {hj}{\caption_hj_instance} } The \Variable, \Function, and \Instance commands above need not exist in general; they can be locally redefined "within the parameter declarations". (Philologically it is not unheard of in other languages to have special sets of commands available within declaration blocks.) Besides avoiding the overhead of a special parser, the above also has the advantage of being more robust by virtue of simplicity and adherence to the general language syntax and semantics, which tend to have their corner cases better worked out than something invented for a special purpose. Lars Hellström