I am using the hyphenat package with the htt option.
The whole thing is used to document an application programming interface (API). Consider the following MWE:
\documentclass{minimal}
\usepackage[english]{babel}
\usepackage[htt]{hyphenat}
\usepackage{hyperref}
\usepackage{xparse}
\usepackage{microtype}
\hyphenation{An-Obscenely-Long-Function-Name}
\NewDocumentCommand{\funcref}{mo}{
\hyperref[#1]{\ttfamily{#1(\IfValueTF{#2}{#2}{})}}}
\begin{document}
foo bar baz \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName} \funcref{AnObscenelyLongFunctionName}
\end{document}
The idea here is to use the custom command \funcref to typeset the function name and refer to a label with that name at the same time. Additionally parentheses (and optionally content inside the parentheses) may be passed as second argument.
Now I have a number of problems with the outcome:
- I'd like to have the hyphenation provided by
hyphenatwithhttoption, but without an actual hyphen character (at least for teletype text). - I'd like to prevent hyphenation to kick in between the function name and the parentheses.
- Ideally I'd like for LaTeX to be able to figure out the hyphenation based on the capitalization inside the function names. However, this one is not a biggie, I can implement this in Python and feed it to LaTeX in a digestible form instead.
Any ideas?

\hyphenchar\<currentfont>=-1to "turn it off". Now you "just" need to figure out the current font when you are using the teletype text. – Stefan Schmiedl Jun 29 '19 at 21:08