Contra Stefan (and therefore contra Leslie Lamport), and at the risk of weighing in on a matter involving personal style, I very much prefer the forms
\newcommand\foo{...\baz{\bar}...}
to \newcommand{\foo}{...\baz{\bar}...}
and
\newcommand*\foo[n]{...\baz{\bar}...}
to \newcommand*{\foo}[n]{...\baz{\bar}...}
.
My reasons are as follows:
- When standing in this position,
\foo
is a distinguished entity with a very different role to to play than \bar
. For that reason, I like to lexically distinguish it as such.
- To run with TH's point above, the pattern
\newcommand*{\foo}[n]{...}
is, for someone who must regularly interpret and sometimes produce TeX and LaTeX-interspersed code, ... well, let's say, a little 'over-ornate'.
Re my second point, the human brain (yes, I actually do hold a research degree in neuropsych and learning), has to manage a huge amount of information during programming and program maintenance. Personally for my tiny little brain, the more regular the patterns it has to deal with, the fewer times it must take its metaphorical eye off the ball and attend to non-problem related tasks. The converse is also true. Of course, I wish it weren't so, but (sadly even more so than in any other computer language I have encountered), this situation is very much the case with the TeX et al. family. [And, here, JW, comes my major and so far only gripe with LaTeX3 - it is layering even more lexical pattern-breaking onto an already complex lexical (let alone syntactic or semantic or pragmatic or programmatic) pattern space. Of course, I agree that there are good technical reasons for this (encapsulation/namespaces being one), however real psychological tradeoffs accrue to real programmers managing real TeX/LateX2/LaTeX3(/LuaTeX) systems. I'm afraid (actually, I'm certain) that as this sort of complexity increases, the program error rate in these systems (and the commercial and non-commercial costs of producing and maintaining them) is going to increase in complex ways as well. Thank God we don't build rocket ships or commercial systems with this code! It might be provably deterministic Turing machine complete, but for heavens sake, TeX/LateX2/LaTeX3(/LuaTeX)'s little programming idioms like \newcommand{\foo}{...}
and myriad ilk add like grains of sand to our psychological ability to build robust stuff in this code. And that is why I prefer to keep lexical patterns like \newcommand\foo{...}
as far as possible in harmony with the patterns that TeX has for better or worse delivered earlier to us.]
My tuppenny-ha'pence, guys and gals, sorry for taking the bait :))