Why is Namespace So Difficult?

By Xah Lee. Date:

Recently, Steve Yegge implemented JavaScript in Emacs lisp, and compared the 2 languages.

One of his point is about emacs lisp's lack of namespace.

Btw, there's a question i have about namespace that always puzzled me.

In many languages, they don't have namespace and is often a well known sour point for the lang. For example, Scheme has this problem up till R6RS last year. PHP didn't have namespace for the past decade till about this year. JavaScript, which i only have working expertise, didn't have namespace as he mentioned in his blog. Elisp doesn't have name space and it is a well known major issue.

Of languages that do have namespace that i have at least working expertise: Mathematica, Perl, Python, Java. Knowing these langs sufficiently well, i do not see anything special about namespace. The _essence_ of namespace is that a char is chosen as a separator, and the compiler just use this char to split/connect identifiers. Although i have close to zero knowledge about compiler or parser, but from a math point of view and my own 18 years of programing experience, i cannot fathom what could possibly be difficult of introducing or implementing a namespace mechanism into a language. I do not understand, why so many languages that lacks so much needed namespace for so long? If it is a social problem, i don't imagine they would last so long. It must be some technical issue?

Could any compiler expert give some explanation?


Xah Lee wrote:

i cannot fathom what could possibly be difficult of introducing or implementing a namespace mechanism into a language. I do not understand, why so many languages that lacks so much needed namespace for so long? If it is a social problem, i don't imagine they would last so long. It must be some technical issue?

Wojtek wrote:

Simply put:

The IT community has enough trouble getting a few ISPs to upgrade their DNS software. How are you going to get millions of general users to upgrade?

Web stats show that people are still using IE 5…

alright, that's speaks for JavaScript.

But how's that apply to, say, Scheme lisp, Emacs lisp, PHP?

In the case of Scheme, i can see that the problem of delay in introducing namespace is due to the nature of community wanting some consensus on the most elegant approach.

For emacs lisp, is it prolonged lack of namespace due to lack of developer resource?

in anycase, the reasons above are social ones. Namely, issues like backward compatibility, agreement on design, lack of developers. I'd be very interested if any compiler writer can give technical perspective on whether introducing namespace to a existing lang is a problem.


Dear Kaz Kylheku,

your post is too much verbiage and enthusiasm.

Why? because you went into the la la land of philosophy.

Although, i do think you did give some good exposition on your views.

Now, let me detail some analysis of your post.

In summary, you are saying a few things about namespaces, for example, you gave some reasons JavaScript doesn't really need namespaces that much, and in general, your thesis is that although lack of namespace is bad, but overall it's ok, and the pain of adding namespaces is more than the problem it solves. You cite C and linux, and some joe blog's philosophy on the multi-core crisis as support.

On the whole, given your post as is, i don't disagree with your general point of view. However, you seem to went onto your own gripe about alarmists, by the magic of vodoo speak and future-predicting formula, wantonly applied it to the namespace “crisis”. And in the process, you seems to brush it off, almost sounding like lacking namespace is a none-problem.

Nobody is saying that lacking namespace is a CRISIS. But it is a problem, a problem that is rather seriously, practically, hampering software development, in PHP, in Scheme Lisp, in Emacs Lisp, a widely acknowledged problem by programers in these communities, counting myself. Nobody is saying that linux development is crumbling just because C lacks namespace. Nobody is saying that human animal couldn't land on the moon when people are still using slide rules and punch cards. (note that the issue proper of this thread is about technical issues of introducing namespace into a existing lang. Am not accusing you of derailing, but just pointing out a background fact.)

Can you see, how you latched your personal beef about anti software crisis philosophy into this no namespace thread?

In your fervor to dispel the software crisis beliefs, you painted a picture that lacking namespace in C, JavaScript, Emacs Lisp, Scheme Lisp, PHP, as trivial, unimportant, none problems.

Do you actually, seriously, believe, that lacking namespaces in these languages is not a problem? Sure, if a programer got a accident and fell into a manhole and broke his legs, i bet he can still live long and program well. But that doesn't mean being a cricrublempple is cool, right?

In your hot haste, you got a few things factually wrong too.

• JavaScript, although used in browser mainly, but that is not its only use. It has huge potential as a general purpose lang. It is adopted here and there as the scripting lang. Check out Wikipedia on it. It lists about 20 such adoptions by various tech or software app as scripting lang.

• You mentioned that adding prefix is a workable solution. Yes, but only to some extent. For example, in elisp, it lacks lexical scope, lacks closure, and its manual suggest that names shouldn't be more than 32 chars. These, seriously put a dent on the workaroundibilities of the no namespace problem. I do a lot emacs lisp scripting, i already felt the pain. Steve Yegge in his blog, for his work of implementing JavaScript interpreter in elisp gave detail. Similarly, lacking namespace in PHP is also a major, practical, problem to web app developers. Scheme lisp's lack of namespace is also a major sore point, being one of its major problems that in their view prevented them from going outside of academia. These are not just made-up scenarios. These are widely acknowledged, practicality oriented, problems. Yeah sure, you can always find some workaround, and the world won't crumble by it, just like cripples and dumb and blind can all still lead a happy and fruitful life.

There is no crisis!


Xah Lee wrote:

Can you see, how you latched your personal beef about anti software crisis philosophy into this no namespace thread?

Kaz Kylheku wrote:

I did no such thing. My post was about explaining the decision process that causes humans to either adopt some technical solution or not.

Yes, you did that by following a moronic pop theory. The purpose of this message is to tell you, that you should have decades of study of multiple deciplines in history, economics, psychology, sociology, to be immune to the lots of pop theories that floats about especially today with the internet.

let me explain why the pop theory you fell for breaks apart with respect to the namespace issue here in this thread.

lacking namespace is not due to some ratio of perceived benefit divided by perceived pain.

The benefit is huge, practical, and undeniable, the pain to adopt the namespace fix is almost non-existant, because any such solution will obvious be done in a backward compatible way. If the solution is provided, the pain at max is just like a version upgrade. Java, Perl, and all langs goes thru major upgrade every few years.

there are social reasions and technical reasons why langs lacking much needed namespace took so long to fix. Social reason being, as others has said in this thread, for examples: compatibilities issues in the case of JavaScript's browser/server situation. In the case of Scheme lisp, there's the issue of committee consensus and the RnRS standard. You can't just have someone created a namespace implementation and have every other Scheme lisp adopt it. As far as i know, namespace has been in lots of Scheme implementations for long. The problem is getting it into RnRs. The situation in Emacs lisp, at least partly have to do with lack of developers, and partly have to do with Richard Stallman. First, you need someone capable enough to actually implement it as some sort of proof of concept, then you have to pass thru Stallman himself, else you get XEmacs fork situation, which significantly hurled GNU Emacs forward for the past about 15 years. In the case of PHP, i suppose the primary reason is that it works without namespace so far. PHP lang is mostly hack. The lang is so messy that namespace is not just one thing that needs to be fixed. All the above reasons, are of social one. There are undoubtly some technical reasons too. I don't have compiler knowledge so i can't say what, but to say the least, that creating a namespace in a existing lang that is widely used in the industry is not something a average computer science graduate can do.

The above are ugly, perhaps complex, real world facts. It's not some pop faaking book about some pop pereciveness of some ratios.

one can go on analyze the perceived benefit and pain about the namespace issue on each language specifically. You can see how it doesn't apply. But going in detail on this'd be waste of time. If you spend your time to debunk pop theories, play their game, the scientific establishment would go nowhere.

There are quite a lot pop books on the market, they usually sells. Their audience is the mass market. They have little scientific value. They are not valued by any expert in any field. Most of them cannot be invalidated in any way. This does not mean pop theory, pop psychology, wisdoms, or anything not dry science, are all bullshit. Ultimately, there is no magic rule that can tell you which is which. The degree and quality of you or the masses's judgement, ultimately depends on your education level. That is why, general education is so important, in every nation and culture, while it's little talked about only because its so obvious, so plain.

here's another pop book you might like: Book Review: Patterns of Software .

this one is published a decade ago by a lisp dignitary. Its theory of programing and software engineering is poetry and taoism. It suggests that C will be the last lang.


The above is culled from comp.lang.lisp newsgroup At Source groups.google.com