Namespace:
It is always surprising how quickly one has found its own solution, after you have posted here... :)
This is a well known psychological phenomenon: when you explain your problem to other people you lay down the problem very well, its constraints, its invariants, your needs, and this helps a lot the problem-solving parts of your mind find a solution :-)
This phenomenon is so strong, that some researchers assume to know a topic well enough only after they have taught one class about it :-)
That's why keeping a "laboratory notebook" for your programming activities, where you write down and explain what you do and what you have done, helps solve your problems. Unfortunately many computer science teachers don't explain their students why and how to keep such notebook.
Bye, bearophile