3

l3styleguide.pdf reads

With the exception of simple runs of parameter ({#1}, #1#2, etc.), everything should be divided up using spaces to make the code more readable.

However, interface3.pdf shows examples both, {#1} and { #1 }.

So, I am a bit puzzled. What the preferred way? Did it change over time?

3
  • 4
    since it makes no difference and the syntax has been in use by different people over a 30 year period some syle differences may have slipped in:-) Commented May 16, 2021 at 20:31
  • 3
    The preferred way is the way you think the code is more readable. Not everyone thinks that spaces achieve that goal.
    – Alan Munn
    Commented May 16, 2021 at 20:53
  • Personally I hate those spaces. Commented Jan 22, 2023 at 1:23

1 Answer 1

2

The style guide tries to codify 'common' practice by the team. As mentioned in comments, on balance {#1} felt more 'readable' than { #1 } in most cases, whereas { \some_funct:N \l_some_var } seemed preferable. It's not universally applied, but is the most common formatting choice so is what is recommended.

4
  • Thanks. interface3.pdf contains {#1} 21 times and { #1 } 15 times . This means the former is "most common", but only by a small margin.
    – mhchem
    Commented May 17, 2021 at 5:36
  • @mhchem Remember there are the cases of {#2} and so on - see e.g. the definition for \use_i:nnn.
    – Joseph Wright
    Commented May 17, 2021 at 7:01
  • Also, you have to remember that say { #1 : #2 } or { #2 #1 } doesn't 'count' (the style guide here is specifically about parameter values given with nothing else and in order).
    – Joseph Wright
    Commented May 17, 2021 at 7:03
  • I did only count the verbatim occurrences of {#1} and { #1 } in the official documentation document interface3.pdf.
    – mhchem
    Commented May 17, 2021 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .