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
Lars Hellström <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Thu, 3 Sep 2009 16:47:07 +0200
text/plain (80 lines)
Frank Mittelbach skrev:
> Will,
>  > On this point, Frank wrote:
>  > > - the key settings more or less completely hide the nature of the  
>  > > key, eg
>  > >   .functions:N means a function is expected (in contrast to a  
>  > > variable of
>  > >   some kind) but it is not clear what kind of function is needed or  
>  > > what kind
>  > >   of variable is expected
>  > 
>  > I don't understand this, sorry. If I write '=f2' then I don't know  
>  > what kind of function is needed (unless you mean the number of  
>  > arguments? Which follows from the function name...), and if I write  
>  > '.set:Nn \l_caption_above_skip' then it's clear that we're setting a  
>  > length in both cases I don't follow your criticism. (But  
>  > I'm probably misunderstanding your point.)
> well you are thinking layer 2/3 ie you are thinking as a programmer, a person
> that is concerned with writing expl3 code. But I want this interface (or the
> spec part of it) equally readable for layer 1 people, ie people that look at
> it from a design perspective, ie those who do not necessarily consider expl3 a
> lingua franca and in fact don't need to (see top part of the message)
> for such a person (imho) seeing that a key "above" expects a length gives
> him/her a clue what to put in the instance decl or that a key "number-format"
> expects a function with two arguments. Those are the important points for
> him/her at layer 1 and that is why I want them to stand out and not to be
> deduced from conventions in the language used at layer 3
> the other point I like to make is that contratry to all good intentions people
> slip up when coding fast "and just to check something out ..." so the right
> hand side might as well be something like \tmpa (I've been guilty on that
> account myself) and then my stay so forever
> of course the key name might be equally bad but that is less likely to
> happen. but again the above is a good example: from "number-format" I wouldn't
> necessarily guess that this key is actually not formatting a number but rather
> formatting a number plus a label, so seeing this key to require 2 args
> signals, "wait, what is this doing"

How about the following: split template creation in an 
interface/declaration part, which only contains things relevant at 
level 1, and an implementation/definition part, to which all the level 
2 stuff is deferred?

This could mean that in the declaration one specifies, for each parameter:

   * The name (key)
   * The type: integer / length / rubber length / instance /
               function with N arguments / boolean / etc.
     (The list need not be closed; one could imagine a mechanism
     for defining new types.)
   * The default value
   * A short description (ignored, can be left empty)

In the definition one specifies, for each parameter:

   * The name
   * What control sequence it corresponds to
   * The nature of the link between the two

Hence the distinction between "length" and "fake length", between 
"count" and "fake count", and between "boolean" and "switch" that 
exists in classical template would appear in the definition rather than 
the declaration; it is an aspect of the link between a parameter and 
its implementation.

Lars Hellström

PS: Regarding the levels, I've got a feeling that the sign is wrong. 
Clearly the basic expl3 stuff (level 3) is lower level than template 
definitions (level 2), which are lower level than template 
instantiations (was that level 1?), which is lower level than the 
document level (level -1), so we have 3<2<1<-1. -3<-2<-1<1 would seem 
more natural, and it also fits with an intuition that expl3 is sort of 
the sub-basement of LaTeX3.