You may have noticed that the latest release of Firefox (2.0) supports JavaScript 1.7.  I was curious about just what the new JavaScript features were so I did a little poking around.  It turns out that if you peel back a little of the arbitrarily divergent terminology you find some features that map perfectly onto Ruby.  JavaScript (1.6) and Ruby already had a lot in common.  But with JavaScript 1.7 its hard not to suspect a conscious, coordinated convergence conspiracy.

JavaScript generators and iterators are now supported through the familiar (to Rubyists) yield keyword.  A generator is a function that yields values – like a coroutine.  It isn’t obvious how to implement the Ruby cornerstone: yield to a block passed to a method, but being able to do coroutines is a welcome advance.

Then there’s this thing that JavaScript 1.7 calls destructuring assignment which essentially lets you have multiple return values from a function – just like Ruby. On the browser front, it looks like IE7 is going to support JavaScript 1.6 and not 1.7 initially, so from a client-side perspective this is kind of academic for the moment.   However the convergence is hopeful from the perspective of can’t-we-all-just-get-along VM sharing a la parrot.