When making changes to large systems, I often face the problem that some piece of functionality needs to get some data from another piece, but they're in different parts of a deep and branching call tree, possibly flowing through event listeners, deferred calls, etc. In this way a simple change can balloon quickly.
A related quote from Yossi Kreinin's blog post at http://www.yosefk.com/blog/i-want-a-struct-linker.html:
You have some kind of data structure that you pass around a lot. Soon, the most valuable thing about the structure isn't the data it keeps, but the fact that it's available all the way through some hairy flow of control.
Global variables are one classic way to let code "shout out" to distant code, but they're known to be problematic. Dynamically scoped variables are a more restricted way, but they're problematic as well.
Is there any programming language research aimed at solving this problem? Can we make it easier to add unanticipated flows of data to a large codebase, while still having static checking, easy unit testing and other goodies?