Or "When would an expression like ###1 be useful?"
In macro programming, it's a well-known rule that you need to double your parameter identifiers with each successive layer:
\def\insult#1#2{%
#1 says #2 is a quack.%
\def\response##1##2{%
#2 refutes #1's claim, saying, ``#1 is a ##1 ##2''.
\def\response####1{#1 says,
``I'm not a ##1 ##2, but a simple ####1.''
(#1 leaves.)}%
Rock on, #2.}}
Why must each layer of definitions double the number of #s necessary? The only reason I can think of is to allow 'variadic parameter insertion', but this fails on the first case:
\def\use#1#2#3#4#5#6#7#8#9{I want ##1.}
\use{3}cbdefghi
obviously does not expand to I want b.
So why is this doubling necessary?
\def\foo#1{\expandafter\def\csname my#1\endcsname##1{#1:##1}and so on? – Joseph Wright Aug 01 '15 at 20:28\def\foo#1{\def#1##1{\def##1####1{#1:##1:####1}}}? What's the reasoning stopping me from using just three#instead of four? I'm not saying that different 'scopes' of macro arguments is bad – they're certainly a crucial part of how TeX is used – this is a question about why it was implemented as it is. – Sean Allred Aug 01 '15 at 20:30##is reduced to#, you of course need powers of two. – egreg Aug 01 '15 at 20:38#,##,####,########unclear? – egreg Aug 01 '15 at 20:42\usemakes no sense, sorry. – egreg Aug 01 '15 at 20:44##in a replacement text produces#then it is inevitable that you need####to put##in a nested replacement text? – David Carlisle Aug 01 '15 at 20:50##was itself an 'escape' for#macro definition in that sense. – Sean Allred Aug 01 '15 at 20:51##1is nothing more than##which produces#and1which produces 1, it is only when (if) that replacement text is evaluated than the resulting#1is seen as a macro parameter reference. – David Carlisle Aug 01 '15 at 20:57