Namespaces: Why Do Identical Names Not Always Conflict?

Namespaces: Why Do Identical Names Not Always Conflict?

A namespace places a name within an explicit scope, allowing the same name to refer to different objects. Two computer files may both be called notes.txt without conflict when they sit in different folders. What identifies each one is not the filename alone, but the folder path together with the filename.

This differs from aliasing. Aliasing gives one object several names; namespaces allow one name to refer to different objects in different scopes. Nor are they simply classifications: classification asks what kind of thing an object is, while a namespace first determines how a name is resolved unambiguously.

Namespaces matter because they keep local names short without demanding that every name in an entire system be globally unique. Yet the scope must remain visible and the resolution rules stable. If someone passes around only notes.txt and drops its path, the ambiguity that the folders had separated returns. Conflict depends not merely on whether two words match, but on where the system looks for them.


Discover more from Geoffrey Chen

Subscribe to get the latest posts sent to your email.