Tue 26 Aug 2008
Embedded JavaScript’s missing link
Posted by J5 under Gnome , Open Formats , Standards , community , usability[5] Comments
I totally agree that embeddable languages is the way to go. I’ve been using JavaScript heavily lately, along with the excellent Firebug for debugging (decent debuggers are something some very big languages are missing btw). The biggest issue I have with JavaScript is it’s lack of structure and horrendous scoping rules (this certainly doesn’t mean you are calling the containing object, especially when running a “method” from a callback).
What would really make JavaScript even more useful is the proposal for JavaScript 2. Unfortunately that presentation was made in 2006 but some, if not all of those features are part of the ECMA Script 4 proposal. They even have a reference implementation up which is under a liberal license (I haven’t looked into it much but it links to a GPLv3 library). As anything in committee, it is slow moving. Hopefully we will see a finished spec sometime soon but I couldn’t find a timeline.
In the meantime there is an ECMAScript 4.0 to JavaScript converter call Mascara. Unfortunately it is under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 license which means the code can not be distributed on many distributions because of the Noncommercial clause. It isn’t always clear what constitutes commercial and most distributions I know of want to allow the possibility of for pay distribution or use in a commercial product by 3rd parties. It also isn’t clear if that license extends to the generated code. Does anyone want to write a GPL version?
Truthfully, I have a dirty little secret – I like JavaScript with all of its warts and hackish workarounds. I like it because I know non-programmers who can grok JavaScript but can’t wrap their heads around Python or C. I attribute that more to the environment than the language itself because it allows for the instant gratification of hitting the reload button and seeing something happen. But what I like even more is the idea of embeddable languages bringing that sort of development process to GNOME. There are a few apps that already do this and though it isn’t as easy as it is with the web whenever I have jumped into one of those apps, such as experimenting with writing a quick Vi mode for gEdit, it is amazingly simple.
What would keep me working in those environments would be an embeddable debugger, object viewer and UI/extension point tree. Whoever writes those components and makes it simple to add scripting to any GObject app will be a hero in the community. Anyone willing to sign up?
[read this post in: ar de es fr it ja ko pt ru zh-CN ]
August 26th, 2008 at 9:10 am
The first link in your post is wrong.
August 26th, 2008 at 9:41 am
Thanks, fixed
August 26th, 2008 at 10:40 am
Some of the work that went into ECMAScript 4 has been rolled into something called “JavaScript Harmony.”
I posted about it here: http://www.0xdeadbeef.com/weblog/?p=616
The short of it is that a lot of the features that were going to be in ECMAScript 3.1 (the next minor version of what we call JavaScript in Mozilla) and ECMAScript 4 (a major revision) were rolled up into something very reasonable. The post is worth reading and the podcast is worth listening to – especially if you’re a language geek.
If you’re interested in scoping and you’re only targeting newer browsers you might want to check out the “let” keyword which is essentially the same as the “var” keyword but with block scope instead of function scope.
http://developer.mozilla.org/en/New_in_JavaScript_1.7#Block_scope_with_let
August 27th, 2008 at 12:25 pm
It would be interesting if someone would write a spidermonkey binding to Gtk+ based on the introspection work.
Maybe we could even put something like that into Gtk+. After all, Qt ships with a javascript interpreter these days…
October 25th, 2008 at 5:34 am
[...] public links >> ecma John Palmieri: Embedded JavaScript’s missing link Saved by reeks on Fri 24-10-2008 Meeting Notes from the Mozilla community: Mozilla Platform [...]