jMar’s Blog: Web 2.0, Meet JavaScript 2.0
The funny thing about this - is of course he chose a completely different set of the “new” features to be excited about. So far I don’t entirely disagree with the tone on Slashdot that they are added a hell of a lot of Java what not to the JavaScript mix. Somebody is probably happy - but I don’t know that I care. I guess I’m just not as bothered by the idea that inheritance isn’t the end all be all (I’m going to blame ruby - which has inheritance but it seems I end up writing a lot more mixins which kind of side step the inheritance issue - it feels like inheritance - except you mix and match willy nilly)
I guess the end lesson of opening the Pandora’s box of altering a language is this - once it is open it will quickly be moved towards Java, Lisp, or SmallTalk (or a mixture of the three).
I’m back in the JavaScript trenches. I continue to be amazed at how flexible the language is - once you really dig into it. That’s the good news - but then comes the bad news.
I’ve grown very used to a number of the great features of Ruby. To be completely honest in a number of cases I didn’t really even think about them being there - because Rails uses them for incredibly great programmer outcomes. Now that I’m in JavaScript and they are missing - the sadness is ensuing.
An easy example of what I’m talking about:
person.name = “Bob Roberts”
person.name #Bob Roberts
On the Ruby side that can actually be implemented as a set of methods on the object.
class Person
def name()
return(@name)
end
def name=(name)
@name = name
end
end
Ruby hides the method part from you - which is nice. If you wanted to get a little crazy you could do it with a method missing call (This is not the way to do it but I’m making a point here - stick with me).
class Person
def method_mission(m, *args)
if m == "name"
if args[0]
@name = args[0]
return true
else
return(@name)
end
end
end
Not pretty - but very very powerful. I’ve run into some really cool articles on meta programming in JavaScript - so I was hoping there was a way to emulate this kind of functionality in Javascript. Turns out - there isn’t. Then I ran into a presentation from Jon Resig (Author of jQuery and JavaScript Bad Ass). If you check out his recent presentation on ECMAScript 4 (You can skip ahead to slide #13 & 14) You’ll see that they are specially adding the features I’m talking about to the new ECMAScript 4 (AKA JavaScript 2.0). There are some other neat things in there (there are also some other crazy things that make it feel much like the time I watch PHP4 convert to PHP5 and it felt like they were adding things based purely on emulating other languages).
That’s the good news - the bad news… FireFox 3 (which is currently in beta) will only support JavaScript 1.8. The only reference to a date in the presentation is 2008-2009. I found this blog post that says they are hoping to firm it all up by October of 2008.
Guess that means I’m not going to be waiting for it - since I actually have stuff to get done right now (almost literally - I have a code demo due on Monday for a library I’m working on). At least I know that the renaissance I’ve seen in the JavaScript world is really just getting started.
*Side Note* - To give you an idea of how not a baked cake all of this thinking is - here is a PDF that shows some concerns over some of the features that are possibly going to be included.
Ok so it looks like Mac OS X tools are starting to show up - Home — gitnub — GitHub
(Since a big contingent of the devs I work with are on Macs this makes me feel a little better).
Now if only I could have externals behave properly when I sync out of the the main SVN server - I’d be happy (able) to spend all my time in git….