A debug print function is useful in so many circumstances, outside of a debugger: log files, exception messages, console and terminal applications are some of the uses. Mostly developer-facing interfaces, of course.
As I mentioned, most modern languages, including Groovy on the JVM, provide something like this out of the box, precisely because it’s useful in so many cases.
I don’t think reflection by itself is the best way to implement a debug printer. Some responsibility should be shifted to the class authors, as is done with .toString()
, .hashCode()
and other such “root” methods.