So I have been looking into the details of what it means for a macro to be \protected and thus be made robust. I have found this question where an answer explains the concept of what it means for a command to be fragile and what \protect does to fix this, quite well.
However, now I have to wonder: Is there any reason why I would want my command to NOT be robust (aka not use\protect in its definition)? After all, fragile commands seem to cause all kinds of problems and the fix appears to (almost) always be to just add a \protect to the command (or use e.g. \NewDocumentCommand from the xparse package, which afaik does automatically create a protected, aka robust command).
\protected, not\protect, which is better in a few ways. – user202729 Jul 19 '22 at 08:30\DeclareRobustCommandis unchanged, it still uses\protect. – Joseph Wright Jul 19 '22 at 08:31\NewDocumentCommanddoes not use the LaTeX\protectmechanism, but the e-tex\protectedprimitive, which has overlapping use cases with\protectbut is fundamentally different – David Carlisle Jul 19 '22 at 08:32\protectworks but\protectedcommands do not (notably if the input ends up being used in a\csname,\protect(should be) locally\stringso will work, but\protectedtokens do not expand so generate low level csname error.) – David Carlisle Jul 19 '22 at 09:21