JavaScript in gnome
November 5th, 2009 — pborBeing away from home, bored and yet too tired to do something productive, I skimmed through the gnome-shell proposal mail thread on d-d-l and spotted the inevitable debate on the choice of javascript as a scripting language for the shell.
Personally I am not a big fan of js, quite the contrary, but lately I had to use it extensively (though not in gnome related context) and at the end of the day it is a language as any other. I am not saying it would be the one I would have chosen, but once you use it a bit and get to know its idiosyncrasies, you get what you need done and move on with life. After all any programming language sucks, each one in its own special way and some more than others, but they all suck.
Reading in the aforementioned thread the reasons why js was picked I would have been totally satisfied with valid answers like:
- “It’s my project I and pick whatever language I please”
- “Some of the more talented and experienced gnome hackers chose it. Trust them”
- “It is not C++ or perl, so do not complain”
Beside given that javascript
- has good free implementations
- is widely used (not only in general, but at this point also by various big gnome projects)
I do not have any major problems with it. After all we have clean and consistent code bases written using GObject C conventions, I do not see why we should not be able to tame js as well.
That said, some of the rationales provided for choosing it in the above mentioned d-d-l thread really really trouble me.
js has no platform libraries, so we can use our own
What kind of reason is that? First of all when you embed another scripting language you are not forced in any way to use its standard libarary as well. Second, having a good standard library (or a large set of third party libraries) is a good thing: I thought we were focusing on implementing good applications instead of reimplementing and maintaining a “gwhatever” library for every problem in the world.
using js will attract web developers
That is plainly naive. First of all I have never hacked on something because it was written in a language, at most I have learned a language because something I wanted to hack on was written in it. Second learning the syntax of a language is nothing compared to learning library API, tools, workflows etc and even if I have not used js in gnome yet, I am pretty sure they differ a lot from what web developers are used to. Last but not least, I’d prefer to attract a single good developer than a hundred people not willing to invest an afternoon in learning a language/api/tool.