Risks with namespaces and functions

While using the “namespace” functionality in your code, there is something that you need to note. The more libraries and namespaces you add to your code, you have a potential risk that you will have multiple functions with the same name within these namespaces. If this happens, the computer can no longer tell which function you are trying to call, because it has become ambiguous due to the namespace being shared.

Here is a scenario to illustrate what happens:

Your boss hands you a memo and tells you to "Go to Room 12 and put this in the machine labeled ‘A’’. When you enter Room 12 you notice that there are two machines labeled ‘A’, one is a copier and one is a shredder. Which machine do you use? Both are labeled ‘A’ but the end result is very different for each machine.


Hey Garrett, Great analogy with the shredder machines! I completely agree! :slight_smile:

1 Like

Privacy & Terms