Building Linux Applications With JavaScript
crankymonkey writes "The GNOME desktop environment could soon gain support for building and extending applications with JavaScript thanks to an experimental new project called Seed. Ars Technica has written a detailed tutorial about Seed with several code examples. The article demonstrates how to make a GTK+ application for Linux with JavaScript and explains how Seed could influence the future of GNOME development. In some ways, it's an evolution of the strategy that was pioneered long ago by GNU with embedded Scheme. Ars Technica concludes: 'The availability of a desktop-wide embeddable scripting language for application extension and plugin writing will enable users to add lots of rich new functionality to the environment. As this technology matures and it becomes more tightly integrated with other language frameworks such as Vala, it could change the way that GNOME programmers approach application development. JavaScript could be used as high-level glue for user interface manipulation and rapid prototyping while Vala or C are used for performance-sensitive tasks.'"
Since javascript is interpreted code and you need the source to actually run it.
So, this is basically Seed uses Javascript to make GTK+ code easily, so you can move on to make the heart of the program faster?
Convert FLACs to a portable format with FlacSquisher
Doesn't this already exist with Python? What advantage would there be to using JavaScript over Python? Python is a much cleaner language...
PyBank is similar. It also uses GObject-Introspection to automatically bind GObject libraries.
In fact, the Javascript side of this article is completely overlooking the technology that is GObject introspection; adding run-time dynamic introspection to C applications (and soon, reflection too).
"Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
Ahh.. nevermind... i don't take Slashdot serious either.. xD
Is this not already present with Perl and Python? I mean, both support GTK and are fairly powerful and efficient...
But, JavaScript for desktop GUIs? That just gives me an odd feeling inside...
To put it bluntly: "Because a lot of people already know it."
The problem with attracting developers is that so many of them these days have went on to develop web applications with awful scripting languages like Javascript, Python, Perl and PHP. Developers know these languages.
Bringing developers to the platform is what's important right now. The libraries have gotten better and better, and now it's time to have some real, awesome applications to use them. Part of that means having developers that actually want to write applications, and that means somehow attracting back the people who ran off to write web applications. And what better way to do that then to allow them to use their existing knowledge?
Javascript is easy and useful. Perl and python have nothing to do with the functionality of javascript. Neither do .net or Java. What exactly are you talking about?
This is news? How is this news? Scripting applications with Javascript has been a feature of Qt for quite a while now.
Don't blame me, I didn't vote for either of them!
Javascript is actually a nice and clean language.
The reason why it has a bad reputation is because of "web developers" writing generally horrible hacks with it. Nothing to do with the language.
Don't quote me on this.
The availability of a desktop-wide embeddable scripting language for application extension and plugin writing will enable users to add lots of rich new functionality to the environment.
Why not Python? Seems like many Gnome apps already have Python bindings.
The main purpose of this project is to enable easy embedding of Javascript into a GNOME application for scripting purposes, on the basis that lots of people know javascript so it makes a good extension language. The fact that you can write entire applications with it is just a (disturbing) side-effect.
But if you really want to frighten yourself notice that these applications are run just like any scripting language in unix - with a shebang header line. So javascript init scripts are now yours to have.
The monstrosity of JavaScript/ECMAScript is more a function of the browser/DOM and not the language. If you get the chance to use some nice prototype-based OO Javascript away from the browser, you'll find that it's actually got a lot going for it.
It could sure do with a nice standard library though, there's a lot of roll-your-own low level functionality going on, which adds to it's reputation as a pig.
Unlike many other scripting languages, JavaScript's standard library is very slim and doesn't come with very much additional infrastructure. Developers who build GTK+ applications with Seed will have to use other GObject-based libraries from the GNOME stack in order to produce full applications. For example, native file access and basic remote data retrieval can be done with the Gio library.
Scripts are pigs. They're good for little maintenance things or tools or whatever. Write a program, that I have to use, with it?! Oh God no!
Interpreted languages are just too slow and in some cases, too flaky for desktops or any other intense application - especially apps that have a UI. Can't stand them!
I actually have been doing this for a number of years and I have done commercial projects using it. I started with Lua but lately I have been using Javascript via Tracemonkey in an attempt to get more buy-in. Javascript looks good because of its widespread web use. Javascript is still a pretty crappy and convoluted language that will probably never be able to perform as well as Lua(JIT) though.
I use it for Windows apps as well. I have my own custom bindings for Win32, FLTK, Gtk+, and Qt. Qt is my favorite right now since they're making it LGPL.
Don't kid yourself though, it will not perform anywhere near as good as an old fashion C/C++ application. I still use C or C++ when I need top performance. A lot of applications don't need it though and the end-user can't tell (my scripted software runs fine even on old 266 Mhz laptops with 128 MB of RAM).
Hasn't KDE had this feature since the dark ages? :D
More to the point - this sounds very similar to QTScript which has been available for more than 18 months (since QT 4.3)
Don't you wish you hadn't wasted 3 seconds of your life reading this sig?
I'd go for Lua. But then again, that's my answer to anything
What part of "Active Desktop" was a good idea? Why are we attempting to recreate that?
At the very least, I hope steps and measures are taken to ensure that there is NO code that can be hidden and that a complete console allowing the viewing and editing of all Javascript code complete with the ability for users to DISABLE it.
I can see where some things would be nice... and in fact, nicer because it was written in a scripting language rather than a compiled or interpreted binary. But there are some things I would rather not see "uncontrolled."
>Javascript is actually a nice and clean language.
It is. I avoided it for years, just because I utterly hate that it was called Javascript. But AJAX forced me to use it. A good programmer can do good things with the language. I refuse to get into what bad programmers can do.
-fb Everything not expressly forbidden is now mandatory.
Javascript lacks a clear way of enforcing interfaces. Any part of the program can extend or modify the prototype of any other object on the fly and wreak havoc by invalidating reasonable assumptions which other programmers had about that object. Javascript also lacks multithreading support (no way to synchronize in the language itself). Closures are nice if you know how to use them, but otherwise they are a serious memory leakage hazard. Last but not least there's the problem that Javascript is the VisualBasic of the web: Everybody and their mother pretends to know how to code with it. When real data is involved, it's definitely going to get ugly.
A good programmer can do good things with any language - That doesn't mean that the language itself is any better than the dung scraped from the bottom of a septic tank
don't forget people who confuse DOM and Event compatibility with the javascript language.
Do you even lift?
These aren't the 'roids you're looking for.
Why take the worst of the web and bring it to the desktop?
You must not have read the article. This is about JavaScript, not Flash.
Gnome guys; don't consider extending or improving XUL. That javascript+gtk widgets model hasn't managed to produce anything worthwhile, now has it? Obviously, you can do it better! Probably 3-4 times over the next 15 years. Good luck!
Lurking at the bottom of the gravity well, getting old
I can't tell you how many user are just chomping at the bit waiting for this development.
I'd actually say it's one of the cleaner of the C-syntax'd languages, and it's certainly less convoluted than, say, Perl....
Tweet, tweet.
Too many exceptions and too vague. No reliable standard implementation.
Semicolons as line endings, for example - in C++/php/perl you need them always, in python you don't. In javascript, sometimes you need them, sometimes you don't.
I really tried to give JS a shot, but when you have the guy that created it saying this or that part of it is a hack, it kinda dims your confidence.
Many programmers I have met, myself included, will pick up php, python, even perl or C++ faster and easier than JS. And it was created for the web, so if web developers have a hard time with it, it kind of defeats the purpose, don't you think?
The problem with Javascript + GTK is that it isn't portable to other platforms, like Windows. At least that I am aware of. We shouldn't be writing applications that run on Linux alone. Its a multi platform world out there. I need to write a small application that runs on Linux, Windows and Mac. I was looking at Javascript and GTK just today. I also looked at Java + Swing and Java + SWT. I think I am going to end up using Python + Qt, although I think one can use Python with SWT or Swing via Jython. In any event while I applaud the use of Javascript, GTK is the last library I use, simply because of its portability.
The Horror.
Lack of type safety?
Someone should write a JavaScript interpreter in Python and then port Bochs to JavaScript so we can emulate a virtual machine's instruction set in an interpreted environment running inside an interpreted environment. Then install Linux with GNOME on a 386, run Windows 3.1 in this environment, and note how much faster it is than you-know-what, when you-know-what is running on the biggest, baddest, the shit, fastest box there is around.
Semicolons as line endings, for example - in C++/php/perl you need them always, in python you don't. In javascript, sometimes you need them, sometimes you don't.
So, as a best practice, you always use them.
Just as with HTML4, sometimes you need closing tags, sometimes you don't. So, best practice is to develop mostly XHTML which is backwards-compatible with HTML4 -- and thus, to always close your tags.
I really tried to give JS a shot, but when you have the guy that created it saying this or that part of it is a hack, it kinda dims your confidence.
That's actually true of many good languages, and of many good systems. Carmack's Reverse is a brilliant hack, for example.
Many programmers I have met, myself included, will pick up php, python, even perl or C++ faster and easier than JS.
Odd -- I learned JS before any of those except C++. It seems as easy as any of the above -- perhaps easier, because if you already know HTML, you already have a GUI to play with, and things like Firebug.
My experience has been that the basics of Javascript are very easy to learn -- much easier than C++, for instance. The more advanced stuff may be hard, but I would argue that it's not hard to know Javascript thoroughly, whereas it is very hard to know C++ thoroughly.
Do you have any specific examples you'd like to talk about?
That's a feature, not a bug, certainly in a language designed for the Web.
Don't thank God, thank a doctor!
I don't understand the "deargodno" and "deargodwhy" tags; forgive me if I'm having an epic sense of humour fail though! I use JavaScript to prototype stuff all the time; you can even use it for animation in the browser (I prototype games and simulations with it, mostly, but see Doug Crockford for more useful programs - the example that readily springs to mind is his symbol table based top down parser which appears in Beautful Code).
At the end of the day it's just another language, albeit one with a familiar (C-descendant) syntax, object orientation, first class functions and (as of 1.7) generators and iterators.
Note that Python (and I do love a bit of Python) supports lambdas but not closures, thus limiting the flexibility of anonymous functions in the language. Javascript in the browser does not support (currently in all implementations AFAIK) tail recursion optimization, although this does not preclude non-browser-sandbox based interpreters from supporting this feature.
Due to the prototype-based nature of its object orientation mechanism (as has already been mentioned) it also allows some interesting opportunities for experimenting with purely behavioural inheritance, something that is occasionally required but not really possible to achieve in any sane fashion in Java (for example; I'm a Java programmer for a living). I'm thinking along the lines of:
var self = this;
this.prototype.behaviour = function(){
BehaviouralObject.prototype.behaviour.call(self);
}
sort of thing. I appreciate this code may be unnecessarily verbose, but I think would illustrate my point at least. There's a lot more that I like about the language, but I feel I've probably gone on far too long by this point.
(Apologies for the AC; it was late, I was tired, and I can't remember whether I have a Slashdot account.)
Javascript lacks a clear way of enforcing interfaces. Any part of the program can extend or modify the prototype of any other object on the fly...
Many of us would consider that a feature, not a bug. But, actually, you can enforce interfaces fairly easily with closures, if you really need them.
More importantly:
invalidating reasonable assumptions which other programmers had about that object.
If you're making assumptions you want others to be aware of, the right place to do so is in documentation. Otherwise, you've got the unsolvable problem of idiot-proofing your code -- they will always build a better idiot.
If people are deliberately breaking the rules you've laid out, you're going to have problems anyway. No language can actually enforce interfaces -- it's always possible for people to go edit that source (or the binary, if they have to), perform reflection (with or without a debugger), or just scribble all over your application's address space.
Javascript also lacks multithreading support (no way to synchronize in the language itself).
Threads are evil.
More relevantly, this actually isn't much of an issue for most real applications of Javascript. I'm sorry, but when was the last time an AJAX application needed to use more than two cores?
Closures are nice if you know how to use them, but otherwise they are a serious memory leakage hazard.
...so learn how to use them.
Citation needed on the memory leakage, also.
Everybody and their mother pretends to know how to code with it.
This is true regardless of language.
Any language can be used to write horrible code. Any language can be used to write decent code. The real question is, how much work does it take to write decent code in one language versus another?
Don't thank God, thank a doctor!
This is a design choice. You're trading flexibility for correctness if you implement type checking.
Any individual who enables the untrusted execution of javascript on their computer is crazy (IMO). If the direction of development (Gnome, etc.) is in this direction it is similarly crazy. Unless Javascript is executing in a completely secure virtual machine (read a completely different VM, e.g. enabled by Xen, VMWare, etc.), anyone who uses it is vulnerable.
You have to make a critical distinction between programs that run on your machine (which is what Javascript is) and programs which draw on your display (which was what HTML was designed to do (back in the "early days")). Any program which runs on your machine is vulnerable to the security flaws of said program. In contrast a program which only directs your program to draw on the display can only mess up ones display.
There is a critical lack of distinction between these two circumstances. And if I would make a recommendation to the incoming presidential staff it would be that Javascript should be shut down on all governmental computers!
No, the way you measure that is how much effort it takes for a good programmer to do good things with it.
Don't thank God, thank a doctor!
"So javascript init scripts are now yours to have."
I actually screamed a little bit. -sigh-
"If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
Let's get pedantic for a bit.
You don't need semi-colons at the end of lines--you need them at the end of statements. And in Javascript, they're always required for the end of statements. What happens is that if the Javascript interpreter encounters an error condition in the parsing of the code, it will go in and see if adding a semi-colon would make the error go away. If so, it will automatically add the semi-colon for you.
This was a design decision that was implemented to make Javascript easier to use. It was also, by most accounts, a mistake. But then, when Javascript was created, I doubt that anyone ever expected huge libraries and programming tasks to be implemented with it.
Isn't this the sort of thing Palm encouraging on their new Web OS SDK? Sadly, I do not believe there is a current option to write binary compiled code on that platform even if you wanted to. I'm happy with Maemo for now.
The javascript core mechanisms are fairly clean, but the language syntax is a horrible mess (but it would be, since they were mimicing C/C++/Java). There is also no need for constructors, or new() or for .. in (with all its caveats). In other words, it isn't that bad, but you really need quite a lot of extra code to make it work effectively and cleanly, and even then it remains mostly ugly to look at.
to bewritten in javascript and run on the desktop...
The Qt API has QtScript, an ECMA scripting engine. While by default Qt isn't fully scriptable, there is a "bindings generator" that makes the whole Qt API available to the scripting engine.
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
True enough, and I have since gotten in the habit of always ending lines/statements with semicolons. But it's certainly confusing for no real advantage.
Javascript is actually a nice and clean language.
The reason why it has a bad reputation is because of "web developers" writing generally horrible hacks with it. Nothing to do with the language.
and now those "web developers" will write horrible hacks for Gnome
Who logs in to gdm? Not I, said the duck.
I really tried to give JS a shot, but when you have the guy that created it saying this or that part of it is a hack, it kinda dims your confidence.
Many programmers I have met, myself included, will pick up php, python, even perl or C++ faster and easier than JS. And it was created for the web, so if web developers have a hard time with it, it kind of defeats the purpose, don't you think?
There is nothing intrinsically difficult about Javascript. It is much simpler to understand than Perl for example. Since all the other languages you listed cannot be used to interact with the DOM on the client-side, I would guess that your difficulty actually was with picking up HTML DOM and event driven / multithreaded coding vs server-side page generation. No one would really argue against the former being harder than the latter, but that doesn't mean you shouldn't use it.
tl;dr PHP coders can't do multithreaded, have to let Apache sort it out for them.
I file this under the "Golly Gee Whiz" category. Just because you can do it, doesn't mean its a good idea. Why? Any truly demanding application must interact closer to the metal. What's next? An ECMAScript JIT native compiler with optimization for the next wave of CPUs? Why not just write an entire OS with ECMAScript. I just plain don't like it. Here is another reason. How do you demonstrate and establish trust with a site that delivers this type of script? If in the long run only certain authorities are distributing "trustworthy" code, then we may end up with another Microsoft style hegemony.
Besides, unless you're using a stone-age JavaScript interpreter (like Internet Explorer's), you can actually define the types of variables. It's optional though, and nowhere near as strict as most statically typed programming languages.
None of which should matter worth a damn for building GUI code.
Jakub Steiner has recently been wanting access to a CSS-type method of styling GTK apps rather than using the traditional widget-mangling stuff. I totally agree...in fact, look at some of the web apps out there that have already far eclipsed desktop applications in visual design, usability, and just overall experience.
If the desktop is going to make a comeback, things like this JavaScript effort and ideas that have their roots in web-team-on-a-deadline-style efficiency are going to have to be ported over to toolkits like GTK.
I guess Adobe Air and whatnot are trying to enter this arena, but I'd like to see other toolkits that are more widely used gain these capabilities.
BTW, I'm not talking about making every desktop app look different from another. I'm talking about coming up with a "look" to apply consistently - just one that actually looks good.
"will enable users to add lots of rich new functionality"
That's why Linux still hasn't beaten Windows or Mac. You people have to stop this thinking that all computer users are nerds with no lives. Windows itself proves that no matter how crappy software is people will buy it if it just works.
Runtime options? I don't want no steenking runtime options.
WTF are you talking about? There's nothing convoluted about it. It's quite simple & straightforward actually.
Did you know that much of the code of Firefox is already JavaScript?
Much of Firefox is done in JS, and it works very well. But more specifically it has managed to spawn an extension ecosystem that they'd want to reproduce.
IMO this is missing just one thing, XUL.
Javascript lacks a clear way of enforcing interfaces. Any part of the program can extend or modify the prototype of any other object on the fly and wreak havoc by invalidating reasonable assumptions which other programmers had about that object.
There's a reason it's called "JavaScript" and not just "Java", you know ...
Oh wait ... they did!
Ignoramus ...
[sarcasm]
Oh I dunno. Showhorning JavaScript into everything because... well because why exactly? That the Gnomes are doing it somehow doesn't suprise me in the least. Nothing invented in the UNIX world has ever interested those guys in the slightest.
Sounds like we need a new language just for this, ya know, a language optimised to be a scripting language to easily embed into other programs and thus avoid reinventing the wheel over and over.
[/sarcasm]
Democrat delenda est
Is this OSS's reply to Windows XAML? This could be a nice alternative.
Dear Gnome project. I am a long term linux user and
also a long term gnome user.
Let me make this perfectly clear. If you script things on my desktop
with either javascript or scheme I will wipe my hard disk and install
Microsoft Windows.
Ps.
I program in both scheme and javascript.
PPs.
You're morons.
What performance-sensitive tasks require Vala or C? Existing performance-sensitive apps already have a web/JavaScript front-end like bank transactions, number crunchers, stock trades, complex domain logic for any businesses -- and all in a multi-user environment, I don't think Vala or C needs to be implemented to achieve performance in most scenarios when it exists in the front end. It's what's at the back-end that counts like locking and synchronization, concurrency checks, thread management, etc. Unless the application is for the buzzers on Jeopardy or a fighter pilot joystick, I think most developers will be able to leave the JavaScript "prototype" as is ... just like with web apps.
yeah right i mention kde and the gnome zealots mod me flamebait.
If you mod me down, I will become more powerful than you can imagine....
http://titaniumapp.com/
This goes further than just Javascript apps, this combines CSS, HTML, etc for use in building desktop applications for Linux (coming soon), Win32 and MacOSX
I refuse to get into what bad programmers can do.
To be fair, bad programmers can write crap in any language.
XML is a known as a key material required to create SMD: Software of Mass Destruction
Since javascript is interpreted code and you need the source to actually run it.
Copyright licenses used for computer programs tend to define "source code" as the preferred form of a work for making modifications. Interpreted code need not be source code; just look at any function that has been p,a,c,k,e,d.
They're already writing extensions to Firefox and I like Firefox extensions enough that I won't consider using another browser for my primary use.
Me lost me cookie at the disco.
Bad programming is not a function of the language or platform used, and believing otherwise is indicative of prejudice, not intelligence.
Embedded scripting isn't anything new even in the GNOME environment. Scheme is the scripting interface generally available for GNOME applications. This development just allows javascript to be embedded in applications. I think this is a good thing. First, javascript is a very good language. Most problems people associate with javascript have to do with the browser and NOT javascript. Second, javascript is known by a lot more people than scheme. It's probably the most well known and used scripting languages in existance. Combine that with the fact that we now have three high performance javascript implementations that are still improving and I think you have a pretty good case for javascript on the desktop. This will only make extending GNOME applications easier. I think GNOME is in good hands if development focuses on Vala/Javascript application programming.
Time makes more converts than reason
See Boost::Python. You just need to know what the hell you're doing in order to bridge C++ and Python properly.
The fact that you can write entire applications with it is just a (disturbing) side-effect.
This is what I've been saying all along. Side-effects are bad. Switch to a functional programming language, such as javascript, today.
Uhh... what were we talking about again? ;)
Folks, isn't this idea was for years around? It is called Rhino (http://www.mozilla.org/rhino/) and it is a JavaScript for Java... As a developer, I am quite pretty puzzled why would someone use this Gnome-only thing, instead to use same approach, yet to do cross-platform stuff?
Yes, I know about GTK is sort of ported everywhere, but I'd prefer Java Swing instead, since it is much better acquires native look and feel. For example, GTK for Mac requires X11 and is like an alien. Even alpha-fragile-sort-of-native-for-mac GTK that does not requires X11 and even has menu on top, still looks different and behaves different (means, no good).
Interesting to hear your opinion here...
It's worth noting that Gjs may not be running with SpiderMonkey's most recent performance improvements.
There have been continued improvements on the engine in recent times as engineers analyze ways for JIT compiling to make the code execution faster.
There, fixed that for you.
(I was going to say "graphics designers who became 'developers'", but there are probably some of those who actually do a good job)
IBM project that was available for public download IIRC. The idea was to allow the rush of new website developers to produce desktop apps with their existing skillset.
If this is going to be capable of running any of the web2.0 frameworks and associated junk then the same premise applies.
Don't know why sash didn't take off, might be worth looking into if any of the dev team care why an identical past project didn't get sufficient uptake.
You might be in for a little surprise.
Dear God, PLEASE, do no let a interpreted language, full of bugs, full of inconsistences, to use into a DESKTOP, LOCAL application. I do not like the need to use 20~60MB of RAM to use a simple calc program.
Religion: The greatest weapon of mass destruction of all time
This is good news, since JavaScript is a good language. I've been working on a pet project for a while, which could perhaps be combined with this, to simplify the inclusion of snippets of C code where performance is an issue. Have a look at http://jsext.sourceforge.net/Including%20C%20functions.html
yes and it lacks strong type, static, abstract Or quite useful things like enum.
You need to hack and to reinvent the wheel to achieve what is merely a line of code in any decent object oriented language.
JavaScript is a great language but I prefer to use it inside its eco-system: the web.
OK, having read through the article, it looks remarkably like what ARexx did on the Amiga.
This was a good idea then, and it's still a good idea now, my only concern with this is the implementation:
Another interesting bit that you might have noticed is that the program uses "forEach" in one case and "foreach" in another. This is because JavaScript's array object uses forEach but GTK+ container objects use foreach. It's kind of tricky and you have to be really mindful of those subtle differences in API conventions.
I like javascript and I would use it to write Gtk apps. The problem I have is that Tamarin, SquirrelFish and V8 are written in C++ when there's plenty of alternative embeddable VM's (lua, nekovm... parrot) in C that would be a better match for Gtk / Gnome.
The better solution would be a javascript compiler with a small runtime, something like Genie. ECMAScript 4 would have made that easier but even now it's a possible and perhaps preferable solution. A register based VM and tracing JIT, written in Vala/C wouldn't be beyond the bounds of reason either.
I didn't read the whole article, but after the first paragraph on Shuttleworths keynote presentation all I could think was "He's talking about ARexx."
It's a version of REXX made for the Amiga for things just like scripts, automation, plugins and to act as a glue between applications.
/ The Arrow
"How lovely you are. So lovely in my straightjacket..." - Nny
In some ways, it's an evolution of the strategy that was pioneered long ago by GNU with embedded Scheme.
Guile was developed as a deliberate response to the early success of Tcl and Tk as an embeddable desktop application language.
Crediting Guile as a "pioneer" is, well, odd.
Another language which is in widespread use gets (specific) linux support. Why you complain?
Is linux suppose to be scripted via "pure" languages only? No alternatives?
Why not Python?????
I would argue that the two reasons to choose a language these days are A) Syntax B) Libraries. If the syntax frustrates you, is bloated, makes it difficult to write large apps (VB, COBOL, XML-languages, etc), you'll demonize it. However, even if you have a clean syntax, if there are insufficient libraries (that are practically trusted across different platforms), then you can't do much more then trivial hello-world apps, or bind tightly to a handful of platforms.
The fact that you can't reliably say, I'm at least version X, and thus I can make use of this suite of features is extremely disappointing in this day and age.. The XML processing library (which is a large part of data-exchange these days, like it or not), the insecurity of using the much cleaner data-exchange format of JSON. The nightmare that is the javascript event model (elegant on a handful of browsers, but nearly impractical in the open-wild).
Argue all you want about how the 'language' transcends these web-centric features - how do you initialize an app? How do you chain-load 'includes', how do you perform IPC, how do you push data-streams into and out of the VM, how do you access files, how do you handle threading (inside or outside the VM), how do you deal with syntax errors (abort, roll back before processing the new script, or skip the lines that failed - possibly to the end of the file (like browsers do)), how do you deal with unicode, how do you deal with date formating (yes there are some primitive routines build in), how do you deal with regular expressions (there is a built-in routine but it has browser differences - which one do you choose).
Ignoring the fact that the stock toolkit is a mixed bread mutt, is like handing off C with no reliable standard header files.. fopen works differently on different UNICIES.. shudder...
That being said, I think javascript is more than adequate for a given plugin.. I use grovy, beanshell,velocity for simple DB-stored/dynamically-modified scripts; no reason to not use javscript there as well.. But these scripting languages are assumed to be relearned from scratch every time they're put into use, because different microversions might have dramatically different ways of interfacing with them. More importantly, your container treats the script like a leperous child.. You carefully massage it's context both before and after execution (fearing memory leaks). It's easier to inject objects with callbacks into the native language than to trust most of it's built-in data processing capabilities.. God help us if they treat dates or matching expressions in an unexpected way. Easier to code something complex into a 'helper' object.
As for most known language 'javascript', I would argue that most people (myself included) do 90% of their javascript coding in copy/paste mode, or have only deeply memorized/internalized trivial onEvent='return myfunc();' where myfunc may be a thin wrapper around someone else's library. So I would hardly say there's a large 'expert' javascript community.
Javascript has a good C/Java base syntax, morphed into dynamic scripting. Has some more modern foreach syntax, but it would be nice to incorporate some ruby concepts.
My main point is that you can't really transfer javascript programming knowledge from the web over to system-programming. You're pretty much starting from scratch. So Javascript doesn't provide any advantage over other existing scripting languages.
-Michael
WTF. If i accept the disadvantages of a scripting implementation, how about something java based? There are jython, groovy and jruby.
I think alot of people have missed the point as to what seed is trying to achieve.
Consider firefox addon's as a good example of what seed is trying to accomplish.
Having done "addon" functionality in a number of places its actually quite a limiting experience, people mention perl, php, c++ and c while talking about bindings... sorry, your missing the purpose. Perl is very bad as an language devoted to creating addon's as is php, while c++ and c are completely out (unless you want to write a c++ or c runtime interpreter... no? well, it has been done, but thats beside the point).
One of the tricky things with righting "addon" features is passing data to and from while retaining control in the original program. Now, you can write something in C and execute perl from there, but you cant easily pass between the two as you would with addon's. C++ and C (compiled to a shared object) it is highly possible, but obviously very limiting. Same with php, you can execute php from within an application (as apache does), but not pass data between the two in a meaningful way. The point is, dont confuse language bindings (i.e. the ability to "create" a gtk gui from perl, pyhthon, php, and the rest) with the ability to embed the language.
The second thing is, people talk about "well, if its JS, it'll have to be opensource!". Again wrong, there are quite a number of things out there (though crackable) that allow you to protect php, perl, python, etc from being "read" (be they byte-code compilers or whatever). I cant see that being such a big problem for JS either.
Personally, I would love to see a more generic approach in the form of "extend mysql functionality with JS plugins" and so forth (insert any application - server or gui or whatever), which i dont see seed being capable of providing.
I'm not sure how much I agree with many parts of your post. I would say that JS does have a lot of quirks, but many of the enhancements to, for example, Spidermonkey 1.6+, the language gets pretty compelling. It's already used in a number of desktop gadget/widget systems already. The language version in Flash is similar. There are some differences, and you are correct that a lot of the code is around wrapper libraries. But, I would expect the same to be true for a JavaScript implementation geared towards desktop use as well. People don't write raw X11 calls, they use SDL, GTK+, Qt etc. There's nothing wrong with that. I for one, very much welcome this option. When I first started playing with .Net, it was with JScript, though I quickly switched to C# as the documentation for JS in .Net was severely lacking.
I just hope that it is well implemented, and well supported. I think that C# (mono) resolves a lot of issues with certain types of development, especially custom/enterprise applications on gnome. I find that Python + GTK works pretty well, but a lot of people don't like Python, or know it. I think giving another functional environment like JavaScript can only be a boon. I just fear the hundreds of crappy applets that will likely come out in place of the few gems, which is the case with Konfabulator (Yahoo Widgets), and with the Windows sidebar/gadgets, and other JS based widget engines. I already use a few applications that JS is the scripting engine, and have played with widget engines, so this will be interesting to me.
Michael J. Ryan - tracker1.info
As for "extreme speed", C++ will almost always be at least slightly slower than C, if nothing else because of data being copied whenever there's an inheritance or overloading
Neither inheritance nor overloading adds more data copying. What are you talking about? C++ function overloading is accomplished by transforming function identifiers to incorporate their argument signatures, thus making two functions with apparently the same name but different arguments actually have unique names. There is no runtime difference at all. Inheritance doesn't involve extra copying either. Are you just making this stuff up? Another poster totally debunked your cache issue, too.
But javascript is an awfully convoluted language. Why does it become easy when you put a language like that into the equation?
To put it bluntly: "Because a lot of people already know it." ... The problem with attracting developers is that so many of them these days have went on to develop web applications with awful scripting languages like Javascript...
You know what I don't think this is accurate at all. Javascript is actually a very elegant language, what is convoluted is the "web" platform.
XUL applications are, in my experience, a lot slower than PyGTK apps running on CPython. Spidermonkey has come a long way, but XUL GUIs are *still* quite a lot slower than PyGTK GUIs. I've been excited about Seed for quite a while, but I hope they'll consider using Spidermonkey. If not, I just might have to create my own GTK+ bindings for it...
Not only does Qt already do JS
But Qt also uses CSS for widget styling.
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
I see that GObject annotation is done through comment formatting.
This seems a bit weird to me because I've always felt that comments shouldn't mean anything.
Eg. You should be able to obfuscate the code (strip all of the comments and change the function/method/class/variable names) and it should still work the same.
Qt's system of using macros to provide annotation seems a lot more sane to me.
It's also more similar to how Java and C# annotations work.
Cheers
Ben
This is about building GNOME applications with JavaScript, and GNOME runs on many different platforms, of which Linux is one, so why in the world is the headline Building Linux Applications With JavaScript?
Oh, kdawson. Explains it.
You know, Microsoft's street address also says a lot about their mentality.
With the possible exception of Ada. I'd kill for some crappy code in Ada. ;)
I know tobacco is bad for you, so I smoke weed with crack.