User: Password:
|
|
Subscribe / Log in / New account

GNOME debates Javascript bindings

GNOME debates Javascript bindings

Posted May 21, 2009 3:31 UTC (Thu) by elanthis (guest, #6227)
Parent article: GNOME debates Javascript bindings

OK, I like JavaScript, in concept. It has some warts (what language doesn't) but they're not deal breakers for most users. It is relatively easy to understand for anything with any kind of programming background, and it's not a horrific choice for a first language, either. It's well known. It's great for what it was designed for... which is not desktop apps.

Why in $DEITY's name are they not using something like Lua, which has almost an identical feature set without the crazy 50 different implementations and non-standardized extensions on top of non-standardized bugs on top of an largely unimplemented standard?

I like JavaScript, but until a real standard (and implementations) come out that include the kinds of features necessary for large application development (e.g., the mentioned let keyword, among a few others), using it for desktop apps makes about as much sense as integrating Python 1.x as the scripting language of choice. Sure, it works, but it's crufty and the world has more to offer these days.


(Log in to post comments)

GNOME debates Javascript bindings

Posted May 21, 2009 10:40 UTC (Thu) by nix (subscriber, #2304) [Link]

Seconded. Also, to be honest, these days Lua probably has *more* people who know how to use it (to some degree) than JavaScript, thanks to Lua's use in major game platforms like WoW. And it's a pretty elegant language as these things go, like Scheme done right and usable by humans who don't think in parentheses.

lua's also got an excellently designed embedding API and FFI from Lua to the embedding host that makes JSC look baroque and SpiderMonkey look horrendous: in fact it's the first embedding API I've seen in years that I'd call pleasant to use. It was designed for embedding, and it shows.

Its only real problem is that some of its more recent features (e.g. modules) are only really documented in a dead-tree book (there's a publically-viewable reference manual, and a user guide for the previous version of lua, but a lot of Lua's power lies in nifty ways of using things, and *that* is only in the dead-tree book so far). Even here it beats JS, though, as all you have with JS is the standard, which is appallingly unreadable even by standards' standards, while the publically-available docs for lua are very well-written (as is the dead-tree book: recommended).

GNOME debates Javascript bindings

Posted May 21, 2009 12:19 UTC (Thu) by knobunc (subscriber, #4678) [Link]

What is the name of the book? It sounds interesting. Thanks.

GNOME debates Javascript bindings

Posted May 21, 2009 13:40 UTC (Thu) by djerius (subscriber, #4489) [Link]

Programming in Lua
Roberto Ierusalimschy

ISBN 85-903798-2-5

Lua and Javascript alternative: Squirrel

Posted May 21, 2009 19:31 UTC (Thu) by atai (subscriber, #10977) [Link]

People may also be interested in Squirrel, a script language currently used in games and other applications with internals like Lua (especially the embedding API) and a C/C++ like syntax which would make people familiar with C, C++ and Java (and Javascript) feel at home.

http://www.squirrel-lang.org/

GNOME debates Javascript bindings

Posted May 28, 2009 3:05 UTC (Thu) by deunan_knute (guest, #290) [Link]

> Also, to be honest, these days Lua probably has *more* people who know how
> to use it (to some degree) than JavaScript, thanks to Lua's use in major
> game platforms like WoW.

I won't argue Lua's inherent fitness for embedding, but what makes you think Lua has a greater userbase than JavaScript? A quick search for 'javascript programming' at amazon yields 2498 book results, whereas a search for 'lua programming' returns 138. the same search terms on google return 36,200,000 for javascript, 266,000 for lua.

GNOME debates Javascript bindings

Posted May 28, 2009 6:49 UTC (Thu) by nix (subscriber, #2304) [Link]

Wishful thinking? :)

GNOME debates Javascript bindings

Posted May 21, 2009 10:51 UTC (Thu) by tialaramex (subscriber, #21167) [Link]

I like Javascript too, though I rarely use it in anger these days.

I don't think (I am not involved in the larger debate, I just read the article) anyone is proposing to use Javascript to _write_ large applications. Adding a few hundred lines of JS here and a few hundred there as glue is quite different from implementing say Evolution or some other large app in JS.

Javascript is well suited as glue, and I don't think any amount of work on it will make it into an excellent application development language. If that's what GNOME is really proposing, well, it won't be the first time they (or KDE) have had a crazy idea I didn't agree with. Lua would also be a good candidate for writing glue, but I don't think it's much better than JS. Javascript has a major benefit of being very widely understood, this has the effect that even if it's technically not the ideal choice it may be a pragmatic choice because you don't have the option of waiting for a crop of expert Lua programmers to volunteer to work on GNOME.

GNOME debates Javascript bindings

Posted May 21, 2009 15:31 UTC (Thu) by gerv (subscriber, #3376) [Link]

I don't think (I am not involved in the larger debate, I just read the article) anyone is proposing to use Javascript to _write_ large applications.

<cough> Firefox <cough> (or large chunks of it, anyway)

GNOME debates Javascript bindings

Posted May 21, 2009 18:47 UTC (Thu) by tialaramex (subscriber, #21167) [Link]

Come on gerv, I've hacked on Mozilla. Am I going to find that Mozilla's AES implementation is now in Javascript? No. The image renderer? No. There are all these big complex systems in C++, and then there's glue holding the thing together, and that glue's where Javascript is (mostly) found.

I recall (I am an old codger) fairly well the work to implement PAC in Mozilla, and basically 95% of the heavy lifting was C++ hacking, and then it needed some glue to connect it up and handle prefs and so on, and that was in Javascript.

And to get to the point where Javascript plays this role, Mozilla had to create XPCOM. So Javascript without XPCOM would be even less suited to writing a whole application.

GNOME debates Javascript bindings

Posted May 21, 2009 20:27 UTC (Thu) by gerv (subscriber, #3376) [Link]

More and more parts are being rewritten in JavaScript, for all the obvious reasons (high-level language, no buffer issues etc.) I don't have the time to run a full code line counter, but:

gerv@otter:mozilla$ find . -name "*.cpp" -exec cat {} \; | wc -l
2211031
gerv@otter:mozilla$ find . -name "*.js" -exec cat {} \; | wc -l
1065187
gerv@otter:mozilla$

Seems to be about 65:35 at the moment. Hardly just "the glue".

GNOME debates Javascript bindings

Posted May 28, 2009 9:20 UTC (Thu) by tdz (subscriber, #58733) [Link]

I write a little graphics renderer as a hobbyist project. Its design is quite similar to Emacs. It is build around a core binary and use JavaScript for scripting.

The fact that there are several independent implementations of JavaScript was one of the reasons I choose it in the first place. So that if one implementation is ever becoming obsolete, I could switch easily; or at least without rewriting all scripts in another language.

As someone else wrote, SpiderMonkey's API is really no beauty. But it is well documented and a lot of people know JavaScript. So getting JS-related knowledge from experienced programmers isn't that hard.

Lua failed in these regards. When I was looking for scripting language, it was on the table but I dismissed it because of the small documentation (compared to JS) and the missing "backup implementation".

Best regards, Thomas


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds