real functions or complex functions [closed]

There are many questions from students about (presumably) real functions of (presumably) real variables. I say presumably, because information is often scarce. Now with real functions there are often issues with domain. Examples are $$\sqrt{1-x}$$, $$\space$$ $$\log(1+x)$$ and $$\tanh^{-1}(x)$$. You may manipulate these functions for arguments outside of their domain, but the result is usually meaningless. It is for this reason that students are taught to first examine the domain of a real function, before the actual calculation (differentiation, integration) is performed.

Now functions such as those above can be analytically extended to the complex plane. Whether this is intended by the teacher or whether it leads to a meaninful answer is unclear. But the answer is then quite different from the real case. The outcome is a complex number; often branch cuts have to defined. The student may well be unfamiliar with these concepts.

So how should functions such those above be treated? As real functions with a domain, or as complex functions? I am not aware of a policy on this matter. I have seen questions where an expert gives an answer, based on the concept of complex numbers. Such answers are then upvoted by the community. The fact that the question may actually belong to the real function category is dismissed. I have also seen opposite cases, where the expert treats the function as real. The answer gets upvoted. If someone else treats it as a complex function, the answer is ignored. Or it leads to comments that it is inappropriate to use complex numbers in this particular case.

A recent example is How to integrate $\int_{0}^{1} \int_{0}^{1} \tanh^{-1}\left(\frac{x}{y} + \frac{y}{x}\right) \,dx\,dy$. Quanto gives good advice on how to simplify the calculation, but in doing so he ignores the important fact that the integrand does not exist because of a domain problem. I pointed this out, but the community is silent.