Firefox 3 and JavaScript 1.8

I finally grew a spine and decided to take the plunge into Firefox 3 beta. Half of my extensions don't work, but only one of them is something I use/need: CS Lite (update: available on addonsmirror). All of these work: Adblock Plus, Firebug (1.1.0b10), GMarks, Google Notebook, Greasemonkey, Secure Login and Stylish. Not bad.

About 15 seconds into my adventure I crashed it. Well, I crash everything pretty quickly after I start using it, I think it's a gift. My dad called it "duodenum hands", although back then it wasn't about programs, it was about... objects in general. Wikipedia says this is where most chemical digestion takes place. As in, destroys everything.

From the what's new in 3.0b3 page, I promply went to "New in JavaScript 1.8". First thing on the list: Expression Closures.

Are you serious? Expression Closures? Ok, it's not obvious what it is. It just means you can do: function (x) x*x instead of function(x){ return x*x; }, when you're using a function as an expression, like: setTimeout(function(){...},10);. It also means it's useless!

First, the only advantage of this feature is that you'll save exactly 8 characters. That's it. Then, nobody supports it. Well, that's understandable, since it's JavaScript 1.8... however, I didn't just mean browsers, I meant IDEs. That's right, you'll be all happy coding along your fancy expression closures and your Aptana will balk, whine and nag. Expression Closures!

Next on the list: generator expressions. Sweet! Surely you understand that Array Comprehensions were available since JS 1.7. Particularly noteworthy, as you know, is that generators aren't run until needed, unlike an array comprehension which is calculated ahead of time. This can be a ginormous performance difference... and you already know this since this is in your every day's cup o' Python.

Hm, that doesn't work as well as Java. Java sucks anyway. Just kidding. But not really.

Skip a bit further down, and you'll see JSON decoding and encoding. While it's not here yet, it's quite interesting. It heralds further adaptation of the next wave of applications: faster, more robust and sort of working in IE11 or whatever :)

Take the plunge. It's fast.

1 comment:

klug said...

JSON decoding? Isn't that just called eval()? :)