Yesterday I read a blog post / announcement about how Gnome is moving to Javascript and I wanted to write some feedback.
It is great that they are trying to use a garbage-collected language for as much code as possible. For a component-based shell UI, Javascript is surely better than C, C++, or Java. I realize they started down this road towards Javascript years ago, but I think it is worth re-considering whether they are on the right path.
With big decisions, it is nice to have a paper trail. I can find no supporting documentation backing up the decision other than one blog post written after the fact, which doesn’t give very much information.
It appears the decision was made in a meeting. It is great to have meetings to discuss things, and it is great to make decisions in meetings, but oftentimes the best results are about moving the decision-making process forward, not actually committing to big things. Even if there were many in that room, there are surely facts they didn’t have, and other interested parties who were not there. There is the risk of “tyranny” by a self-selected cabal. Hopefully the decision wasn’t made at a bar 😉
I believe the best choice for Gnome is Python, not because the language is necessarily a lot better than Javascript, but because it is already close to the standard scripting language of the Linux desktop. My Mint-Debian repository has 1809 Python packages, and only 301 for Javascript. (Vala has 68.) Was data like this taken into account during the decision-making process? Without a paper trail, there is no way to validate the analysis or circulate it for feedback. There are many reasons to use Python, but the most important is that it is already so popular on the free desktop. The best reason to use Javascript is if you plan on running inside a web browser. Anyone writing code for the Linux desktop and not constrained to a web browser can do better.
To be clear, some of the reasoning is explained. Here are my responses:
1. Our language of choice needs to be dynamic and high level.
Python and many languages fit that description.
Next, it says:
2. There is already momentum in the GNOME Project for JavaScript — it’s used in GNOME Shell and GNOME Documents.
Unfortunately, that is not really much of a reason. In fact, it could be perpetuating a bad plan with this logic.
Next:
3. There’s a lot of work going into the language to make it especially fast, embeddable, and framework-agnostic.
Every language works to make itself fast. There are lots of efforts to make Python fast such as Cython and PyPy, and as many Gnome libraries will remain in C, this is hardly an issue even with the standard CPython implementation.
I’m not sure what the benefit of being embeddable is for a desktop UI. And Python is embeddable as well, inside apps like LibreOffice. I don’t undertand what the benefit of being framework-agnostic is. Every language needs libraries, and a rich set of libraries is a good thing.
4. JavaScript is increasingly being seen as a first class desktop programming language — it us being used in Windows 8, mobile platforms, and for local web applications.
Aren’t Windows 8, mobile, and local web applications supposed to be a worse experience than a Linux desktop? I imagine living exclusively in any of those platforms and shudder at the thought. They also aren’t planning on sharing code with any of those groups. Please don’t try to convince people the Gnome future is bright by using those three examples!
There is another post by John (J5) Palmieri who appears to be a fan of Python but who nevertheless endorses Javascript for Gnome. In it, he says that Python has a lot of baggage. Unfortunately, he doesn’t describe or link to a document describing what he’s talking about. In addition, it is important to weigh the good (the existing libraries and free software programmers) against the baggage. Every language has some baggage. For example, there is a book called Javascript: The Good Parts, which says something about Javascript’s. Furthermore, Python is setup to evolve and periodically break backward compatibility via things like the Python 2.x / 3.x branches. Can Javascript ever remove its cruft?
My day job is trying to finish a movie (trailer) endorsing Python as part of math literacy. Changing how math is taught to children could take a generation. But if Gnome get going now, they will be ready, and hopefully also be better than Gnome 2.x by then 😉 (I’m stuck in MATE. I believe the decision to remove Gnome 2.x is as good an idea as LibreOffice removing DOC import. This decision can be revisited also, but given how long ago it was made, I’m sure people are tired of the topic, so I will end here.)
Update: Some suggest that Javascript is more popular than Python as being a reason. Google trends show that Javascript popularity is dropping dramatically and the two are close today. Furthermore, most of those people are building random websites, not writing code that ships in Debian. And as pointed out in the comments, a recent TIOBE survey shows Python as more popular than Javascript. Python is also replacing Java in introductory CS classes.
Leave a Reply