There's this absolutely mind bending idea that is - every single function should have a unique identifier. Which is to say: def square(x: Int): Int = x * x should get hashed (and if it has dependencies, they should get hashed in there, too), and your programming language should track the unique identity of this function, and keep a list of names separately from the hashes. This totally solves the localization problem…
EDIT: I am asking more about the hashing function than about the language. Because if there is a recursive function, that means that one would need the hash of itself in order to compute its own hash. One can probably try to compute a hash iteratively until a fixed-point is achieved.
EDIT2: but... it is probably a bad idea to do that.