I feel particularly bombarded by sub-atomic particles right now (and it's mostly Will's fault
:)). First, in Will's answer to this question today, he referred to
\prg_case_str:nnn command. Digging into the package, I noticed the command involves an interestingly named macro called
\quark_if_recursion_tail_stop_do:nn. All I can gather from the
expl3 documentation about things with the word (particle
quark in their name is that:
l3quark A ‘quark’ is a command that is defined to expand to itself! Therefore they must never be expanded as this will generate infinite recursion; they do however have many uses, e.g. as special markers and delimiters within code.
Coincidentally, Will and Kevin's new
hardwrap package was released on CTAN today (many congrats guys!). Digging into the documented code, I notice:
This is a ‘quark’ from expl3 designed to delimit scanning; it will never be executed, else an infinite loop results.
Reading the remainder of
hardwrap's code, yes,
\hw@scanstop is used in exactly the way described in the definition of l3quark, above.
Still, I'm perplexed. What's so special about self-referencing tokens as opposed to any other token assigned a special-purpose name, i.e., any other vanilla signifier, whether a command sequence or not? Are they self-referencing only for error-catching purposes?
If LaTeX quarks do have interesting properties beyond just being specially defined and used signifiers, where, when, how and why should I best employ them?
Are they really
expl3 specific, or is it more a convention that has been adopted into the LaTeX3 programming patterns set?
Finally, out of interest (in the spirit of Yiannis's recent question about Lisp
cdr "relics" in TeX's lexicon), what's the story about how the word
quark found its way into LaTeX3 vocabulary? (Please tell me that
LaTeX3 quarks aren't envisioned to possess color, flavor, etc. properties!)