![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Rik Kabel schrieb am 24.01.2021 um 05:13:
Hans and all,
Preparing my standard environments for future strict enforcement of overloading prevention, I have run into one issue.
I had been using the following construction to change the formatting of URLs:
\let\OrigHyphenatedurl\hyphenatedurl \starttexdefinition hyphenatedurl #URL \begingroup \URLfont\OrigHyphenatedurl{#URL} \endgroup \stoptexdefinition
You can use a hook to change the font for \hyphenatedurl. \starttext \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \appendtoks \it \to \everyhyphenatedurl \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \stoptext
This results in the following warning about overloading \hyphenatedurl:
csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 1
I have tried adding \overloaded to indicate the intentional overloading, but \overloaded cannot be used with \starttexdefinition, so I rewrote it as:
\let\OrigHyphenatedurl\hyphenatedurl \overloaded\define[1]\hyphenatedurl{% \begingroup% \URLfont\OrigHyphenatedurl{#1}% \endgroup}%
but that (and also with \overloaded\def\hyphenatedurl#1...) gives the same (except for the line number) warning:
csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 822
So, what is the proper way to indicate intentional overloading? Or should this redefinition be done in another way?
The best solution is *to not* overload commands because there are either alternative ways to achieve the desired result or other commands which can be used. \overloadmode=4 \starttext \permanent\def\mycommand#1{[#1]} \mycommand{Old definition} \pushoverloadmode \aliased\let\originalmycommand\mycommand \permanent\def\mycommand#1% {{\it\originalmycommand{#1}}} \popoverloadmode \mycommand{New definition} \stoptext Wolfgang