# Math foundation for namespace problem

TLDR;
What is the mathematics foundation for the namespace problem? Can I reduce namespace problem to set theory or other math concepts/objects (lambda calculus, category theory)?

I'm doing an essay on concepts like namespaces, packages and modules in programming languages. Among other topics, I'm studing how to avoid names collitions and in particular how programming languages solve the problem. For example:

Given any programming language, suppose that we have following user defined functions (or other language specific "object") named $a$ and $b$:

function a () {
// do something
}

function b () {
// do something
}


And a function called $c$ that uses above functions:

function c () {
a();
b();
}


If in the "context" above we defined another function called $a$, we would have a collision in function $c$ because it doesn't know what $a$-function implementation must use.

So to avoid name collisions a programming languages can implement namespace/package/module systems and let the programmer doing something like the following:

module alpha{
function a () {
// do something
}
function b () {
// do something
}
}

module beta{
function a () {
// do something
}
}


And then doing:

function c () {
alpha.a();
alpha.b();
}


or

function c () {
beta.a();
alpha.b();
}


Thanks.

• Often namespaces are generalized to be modules with an interface and multiple implementations, and multiple parameterized instantiations (think of objects as namespaces). In that case, you may want to look at existential types: cs.cornell.edu/courses/CS4110/2012fa/lectures/lecture26.pdf
– pron
Dec 19 '16 at 8:18
• This is not a research-level question, please move over to cs.stackexchange.com and it's not clear what you are asking. It looks like you just need to consult a book on principles of programming language and read about type checking and the concept of typing context. Dec 20 '16 at 7:32
• "a" is nothing else than a constant that has as value a logic; you can model it as any other constant Dec 23 '16 at 17:56