My understanding is that, when stdout is used for output, stderr is ignored. Similarly, it would seem that, when a function's return value is used for output, stdout and stderr should be ignored. After all, this Racket code prints
#<procedure>, and yet no one would complain about it:
(lambda (x) x)
My use case is that, in an answer I'm working on, defining a function prints its name because of the requirements of the problem and a quirk of the language. This is not just about code golf (actually, it's for a cops-and-robbers challenge).