This part of etoolbox is rather tricky, but not really complicated, once one gets the idea.
When LaTeX executes \usepackage, the named file is loaded and @ is considered as a letter, which makes it possible to use it in macro names.
The etoolbox package needs to change category codes in certain parts of it, so it wants to be sure to restore those settings at the end.
Here is the code:
\def\etb@catcodes{\do\&\do\|\do\:\do\-\do\=\do\<\do\>}
\def\do#1{\catcode\number`#1=\the\catcode`#1\relax}
\edef\etb@catcodes{\etb@catcodes}
\let\do\noexpand
\AtEndOfPackage{\etb@catcodes\undef\etb@catcodes}
The first instruction stores a list of the characters that potentially change their category code in the package, to be restored at the end.
The \do macro is a traditional macro for defining lists, and it can be redefine to execute the list. In this case it is redefined so that, for instance, \do\& expands to
\catcode\number`\&=\the\catcode`\&\relax
If the code after the definition of \do was just \etb@catcodes, TeX would transform the above code into
\catcode 38=4
which would be useless, because this is the current setting. Instead, etoolbox wants to save these settings for the end, so it does
\edef\etb@catcodes{\etb@catcodes}
which does similar complete expansions for all stored characters. Since \edef does complete expansion before assigning the meaning to \etb@catcodes, there's no danger of infinite loop; at the end, the definition of \etb@catcodes is equivalent to
\def\etb@catcodes{%
\catcode 38=4\relax
\catcode 124=12\relax
\catcode 58=12\relax
\catcode 45=12\relax
\catcode 61=12\relax
\catcode 60=12\relax
\catcode 62=12\relax
}
but with a fundamental difference: if some package has changed the category code of, say, | to 13, there would be
\catcode 124=13\relax
in the definition of \etb@catcodes.
At the end of the package, \etb@catcodes is executed, so restoring all category codes to the previous state and the macro is undefined.
etoolboxtreats basically withLaTeXyou won't be successfully looking into D.E. Knuth's TeXBook. The@is a very often used technique inLaTeXto concat command sequence names etc and to hide the more elementary macros from ordinary user's application, since usage of@requires some additional 'setup' -- it can't be used accidentally in this case, at least not without warning or error message. But your question itself is unclear – Jul 20 '15 at 21:35@, see What do\makeatletterand\makeatotherdo? (possible duplicate). – Werner Jul 20 '15 at 21:41