Wednesday, July 16, 2008

Don't C++ Javascript!

After reading Douglas Crockford's latest book Javascript, the Good Parts, I came to appreciate more the small elegant language hidden inside Javascript.

However, I'm worried it's going to go the way of C++ with the new EMCAScript standard.  I don't think we need to turn it into a class-based language.  What I think should be fixed, though:

1. Block scoping--I just can't get used to the function scoping of Javascript when it looks so much like C.
2. Getting rid of globals--default globals are just wrong.
3. A simple namespace mechanism.
4. How about generating an error if you use a variable before it's set? 
5. Fix == and !=
6. Get rid of needless keywords, add missing ones (like undefined) 

Maybe instead of bloating up javascript, people should focus on a re-write of the browser DOM API.

No comments: