0

Reference to 'namespace', in Namespace - Wikipedia:

In computing, a namespace is a set of symbols that are used to organize objects of various kinds, so that these objects may be referred to by name. Prominent examples include:

  • file systems are namespaces that assign names to files;[1]
  • some programming languages organize their variables and subroutines in namespaces;
  • computer networks and distributed systems assign names to resources, such as computers, printers, websites, (remote) files, etc.

I could grasp the idea of referred to by name and understand name,

Nevertheless, I struggled but failed to distinguish 'namespace' and 'name',
what's the space in 'namespace'?

muru
  • 72,889
Wizard
  • 2,503
  • It’s not clear what you are asking.  Do you have a problem distinguishing between the concepts of “name” and “namespace”, or are you just questioning why a namespace is called a “namespace”? – G-Man Says 'Reinstate Monica' Apr 07 '18 at 03:01
  • The distinction between a set and its members is not always intuitive, especially if they have some characteristics in common. @muru's answer below is a good one, but you might find it easer to think of prefixes and suffixes. If you had two function definitions called bar() and baz(), and you put them into the class definition for the foo class, then - in many programming languages - they would be automatically placed within the class's namespace, becoming foo.bar() and foo.baz(). See how the namespace became the prefix and the names became the suffix of the qualified name? –  Apr 07 '18 at 03:04
  • On a different note, it isn't clear from your question how you think this - or indeed your other question - relates to Unix or Linux. Perhaps StackOverflow would be a more appropriate venue for them? –  Apr 07 '18 at 03:08

2 Answers2

1

Space here is used in a sense similar to the mathematical concept of space:

In mathematics, a space is a set (sometimes called a universe) with some added structure.

A namespace is a set of names.

muru
  • 72,889
0

Did you also read the second paragraph of the Wikipedia page?

Namespaces are commonly structured as hierarchies to allow reuse of names in different contexts.  As an analogy, consider a system of naming of people where each person has a proper name, as well as a family name shared with their relatives.  If the first names of family members are unique only within each family, then each person can be uniquely identified by the combination of first name and family name; there is only one Jane Doe, though there may be many Janes.  Within the namespace of the Doe family, just “Jane” suffices to unambiguously designate this person, while within the “global” namespace of all people, the full name must be used.

So in this example “Jane” is a name and “Doe” is a namespace.