Can anyone kindly explain under what circumstances it is preferred to put a Listener type inside the scope of its broadcaster vs giving them both the same scope?
For example, I see inside the JUCE codebase both:
In all modern code, we go for the inner-class approach, because it keeps the outer namespace less cluttered.
The reason there are still some old-style listener classes hanging around is that old versions of MSVC used to have bugs handling inner classes, and this made it difficult to use them. Nowadays that’s no longer an issue, and TBH I’d tend to update old classes when I see them. Had no idea that MidiKeyboardStateListener was still done that way, it could be tidied up…
Many thanks for the speedy explanation @jules - I really appreciate it, as always!