Why is there no \ProvideCommandCopy

latex3macrosrobust-commands

When we look at xparse package documentation there are four related commands

\NewDocumentCommand
\RenewDocumentCommand
\ProvideDocumentCommand
\DeclareDocumentCommand

Similarly there are four commands for environments. When I've learned about \NewCommandCopy I've expected a similar four commands will be available. But looking at LaTeX source I've only found that

\NewCommandCopy
\RenewCommandCopy
\DeclareCommandCopy

are defined.

Is there a technical reason why \ProvideCommandCopy was not defined?

EDIT: Example usecase

In the answer by Phelype Oleinik it is claimed that there is no usecase for such command.

Let's consider that we want to provide a black-and-white switch for the document and we want to use \IfBooleanTF from xparse because we are familiar with it. We know that it exports values \BooleanFalse and \BooleanTrue so we may write for example

\NewCommandCopy\blackandwhite\BooleanFalse

\IfBooleanTF{\blackandwhite}{...}{...}

Let's say we want to pass it when compiling document such as pdflatex '\NewCommandCopy\blackandwhite\BooleanTrue\input{document.tex}'. This will obviously cause errors because \blackandwhite is already defined. If there was \ProvideCommandCopy we could use it to define the default value of \blackandwhite switch in case user does not provide it. Currently we are forced to always define it explicitly.

Obviously there are other ways to make the black-and-white switch work as intended, but I think this is a valid usecase of ProvideCommandCopy.

Best Answer

There isn't a \ProvideCommandCopy because it isn't useful (and may be harmful even), so the decision was to not implement it. There is a note in the implementation (texdoc source2e, section Copying robust commands in ltdefns.dtx):

A \ProvideCommandCopy isn’t defined because it’s not reasonably useful. \provide... commands mean “define this if there’s no other definition”, but copying a command (usually) implies that the command being copied is defined, so \ProvideCommandCopy doesn’t make a lot of sense. But more importantly, the most common use case of copying a command is to redefine it later, while preserving the old definition, as in: \ProvideComandCopy \A \B  \renewcommand \B { ... \A ... } then, if \A is already defined the first line is skipped, an in this case \B won’t work as expected.

Related Question