I've mostly been shooting 9s lately, largely for reasons of convenience and affordability. But the .40 is a superior round to the 9 in every way, beyond debate (recoil has a subjective element, and therefore I would exclude it from objective assessments of a given caliber). People love to quote that there have been recent advances in 9mm, and that's true, but these advances aren't limited to the 9, and even with these advances, it still can't touch a .40.
On the other hand, many seem to continue to think that the .40 is a "compromise" round between the 9 and the .45 and I couldn't disagree more. It isn't "in between" these two rounds at all, instead offering superior characteristics to both. This also isn't really up for debate, except amongst those who continue to have an emotional attachment to their favorite caliber.
Paul Harrell has produced some excellent, no-nonsense comparisons of the .40 to the 9 and .45 on his YouTube channel. I would recommend checking them out, if you haven't.
Bottom line, I'm going back to the .40 S&W for most applications.