I was peeking at the LaTeX3
Github repository and specifically l3auxdata.dtx
. There was a surprise for me, as I have been practicing and studying the expl3
syntax and modules for the last couple of weeks. The surprise was code like:
\def\auxwrite{\auxdata_write:nn}
\def\auxshipout{\auxdata_write_shipout:nn}
I am not too sure if there was a reason for the code to use \def
, but this reminded me of my own difficulties with the syntax.
There is a great temptation when starting with expl
to bypass the verbosity of the expl
language and use \def
and TeX
primitives. When I started with expl3
I was literally translating LaTeX2e
code in my head and then writing it down. Pretty much like when you learn a foreign language.
I have by now mostly overcome this as I forced myself to do the following:
- Avoided
\def
s. - As the too many underscores bothered me, at the beginning I wrote functions as
\module_dosomething:nn
. This way I was a bit quicker with debugging and typing. Only started addingl_
org_
much later or on refactoring the code. - I mentally kept reading the commands together with the argument specifier until it started sinking in. Like
module dosomething en en
. The reason I kept forgetting to write the specifier. - When I used a
tex_<cs>:D
like a command, I went back and refactored the code later to remove it. - Write notes with examples as I practice the commands. This can be also useful to others.
Do you have any additional tips and tricks to share?
seq
,prop
,clist
,tl
,box
,msg
,keys
,fp
,file
,bool
, etc. You will get the idea of what's there already done; you will avoid being in a situation when you discover thatprop
orseq
exists that could have solved 30 minutes of your code that you wrote two days ago. I think getting that general idea is fast (less than half an hour) and then, when you see a problem yo know where to see if there's something ready for you.\l_
or\g_
?