I think one of the reasons JS succeeded is precisely a major complaint of experienced developers: globals [1]. But this, (perhaps as with PHP) is what enabled novice developers —some of whom eventually became experienced developers—to learn the language easily.
We all started with some bad practices, and as we matured our code did too. But the loose, forgiving standards are precisely what enabled broad use in the first place.
When a language imposes more constraints on the programmer (it may be for their own good!), it limits adoption and growth.
1: From the summary of Javascript: The Good Parts, "... Douglas Crockford identifies the abundance of good ideas that make JavaScript an outstanding object-oriented programming language-ideas such as functions, loose typing, dynamic objects, and an expressive object literal notation. Unfortunately, these good ideas are mixed in with bad and downright awful ideas, like a programming model based on global variables."
I think there are very few who would say that globals shouldn't be allowed altogether. The problem is that JS relies a bit too much on globals all being crammed into one namespace.
I'm an advocate of the python model (although I should maybe call it the Modula-3 model): only allow module-level globals. You get globals if you need them, but no worries about code mangling your variables.
This is what I like about CoffeeScript too. It wraps the module in a closure, so globals are opt-in. By default, the variable will be scoped to the generated module, but you can simply attach it to the global namespace (window.foo=x in the case of a browser-side CS).
Actually, Gilad Bracha, one of the designers of Dart does say exactly that. He's also working on another language that has no static (ie, global) state. See http://newspeaklanguage.org/
I think you're on to something there. Doesn't processing also encourage the use of globals as a way to make it more accessible to artists who are just learning how to program?
Not quite. Ruby also has easy globals, meaning that you can start out learning it by writing tiny scripts and not worrying about creating your own classes, modules, multiple files, etc.
The difference is that JavaScript has a design flaw in that if you forget to declare a variable before you use it, it becomes globally scoped. This causes local variables inside functions, for example, to become accidentally global leading to bugs.
We all started with some bad practices, and as we matured our code did too. But the loose, forgiving standards are precisely what enabled broad use in the first place.
When a language imposes more constraints on the programmer (it may be for their own good!), it limits adoption and growth.
1: From the summary of Javascript: The Good Parts, "... Douglas Crockford identifies the abundance of good ideas that make JavaScript an outstanding object-oriented programming language-ideas such as functions, loose typing, dynamic objects, and an expressive object literal notation. Unfortunately, these good ideas are mixed in with bad and downright awful ideas, like a programming model based on global variables."