4 ms·
You're quite right, but does it make sense to conflate objects and namespaces that way? Might it not make more sense to separate the concerns?
by wtbob 11y ago
You're quite right, but does it make sense to conflate objects and namespaces that way? Might it not make more sense to separate the concerns?
- akavi 11y agoIt might, but it also might be more typing/visual noise for little benefit.
- kazinator 11y agoObject must have name spaces by definition, because they are collections of named properties. These name spaces do not have to be conflated with program lexical scopes, whereby if you are a piece of code such and such a "blessed" function, you "see" the name space of the class as if it were lexical variable bindings. You definitely don't want crud like different scopes in the program which are all working with exactly the same object, and want to access slot S, but they all refer to a different S because they are associated with a different place in the inheritance hierarchy, and that hierarchy contains unrelated slots named S at different levels. A given object must just have one S.