Compared to my high school experience of learning in a C/C++ mismash with a teacher who insisted on introducing pointers very early, before ever presenting me with anything interesting to do which would make me want to figure out the details like that (and which scared me off programming for four years), I think it sounds like a dream.
I would be very happy if these kinds of irrationalities could be ironed out in a future version of the language, even if it meant backward incompatibility.
If the language is thoroughly rationalized and there is a simple, beautiful API for graphics then I think it becomes the beginner's language to end all (since client-side web is such a nice platform to target). But for now, it isn't there... I'd be happy to hear that it was a priority.
Perhaps something like Dart will pick up that quest.
I think things like dynamic "this" in javascript will be more confusing for newcomers. But, once you start talking about "this", you should probably already have the basics down.
Edit: With all that said, I'm not saying Javascript is a great language to learn programming with. But I don't honestly know of a single language that I would be perfectly comfortable telling people to learn with. Most languages have their own quirks.
var a = {} + [];
var b = [] + {};
var c = String({}) + String([])
All three are equal. The order does matter in general because its doing string concatenation which obviously matters ([1] + [2] == "12"), but the fact that js always does string coercion and concatenation anytime you have + without numbers on both side isn't really that crazy.
There are plenty of parts of JavaScript like that, but these gotchas are just red herrings. The core language is great.
Case in point, recently some chick from highschool asked me where she could learn to code, so I pointed her to some Scheme tuts, nothing too complex since she requested something as easy as possible.
....then she writes back asking if "this is what jquery uses". I say "no", she gets upset and ask me "what the hell is this for then?"
Long story short: for a lot of people out there is not about learning how to code but learn-X-to-do-Y no more no less...
If you're going to ask people to download something, I still think Smalltalk is a nice alternative -- and it has been for a while:
Notice that I'm not saying these things are bad, but they are certainly more than a beginner needs to learn basic syntax and become familiar with control flow.
I don't think you disagree with me at all... I said that javascript feels strange to me because I didn't start with it. I think it's a fine language to start people on, just an uncommon one that should yield interesting results.
I certainly wouldn't suggest teaching with more "rigid" languages. I was trained on Java, and looking back I can see what a terrible way of doing things that is.
FWIW though, it's been my experience that for all but the most trivial tasks in Javascript, you quickly find yourself getting into somewhat advanced territory with e.g. scoping, closures, and anonymous functions. Again, I think these concepts are mostly weird to me just because they're different than what I personally was trained on, but they're certainly not as easy to grok as e.g. variable assignment and conditionals.
In that way, I certainly see what you're saying. It'll be interesting to see what new problems emerge if this continues as a paradigm for teaching how to program.
If you learn from good tutorials it can be as good as learning with scheme.
Granted the stuff you made was nothing like the 3D shooter you played in the evening, but it was something _you_ made that made it really cool. JavaScript works really really well in that regard in that you can easily make stuff appear on the screen with very little effort with html (and move onto canvas / webgl) and they don't look half bad. Unlike other programing languages graphics are "built in". Python is great, but compare drawing on the screen in C++/Python/Java v.s. JavaScript and you get my point. As a first language it is a perfect choice as it is something you can get excited about.
It's simpler than most OO languages. Not sure why you think it doesn't scale as well.
The reasons why JavaScript is thought not to scale well are very-well known. They include:
Minor syntax issues:
- Deeply indented callbacks, passing a function to a function to a function and the resulting complexity of flow control.
- Issues with "this" become more likely with larger codebases. I know that JavaScript's "this" WTF is very old news, but it's the gift that keeps on giving.
Major design issues:
- JavaScript is not an OO language, it is a language that provides an OO construction kit. The OO patterns are layered on top of the language, the best idioms (e.g. self-invoking anonymous function, revealing prototype pattern) are not obvious and took a while to become common, and since none of them are mandatory, they can be ignored, mixed and matched or just gotten wrong. This is not a prescription for trouble-free scaling of the code.
- Lack of a built-in packaging/module or linking system. Requirejs is filling this gap, but for a long time most JavaScript code just wasn't partitioned, it was put all in one file. It is unreasonably hard to build large systems this way.
But in terms of JavaScript specifically, I think first timers could do without being exposed to lexical scoping and truthiness.
I like that Javascript gives you encapsulation without necessarily object orientation, which is probably a good place for beginning programmers to start.