You Got A Question? Ask    GNOME Community!

JavaScript to be the primary GNOME language!

This post was made with an older stylesheet

Why Javascript

Because there isn’t one single developer worldwide that doesn’t know Javascript or can’t learn Javascript in 1-2 days. The other huge advantage of Javascript is that doesn’t ship its own set of libraries and that makes it a perfect solution to be used in systems as scripting high level language. Also since JS doesn’t need compiling, JS Apps can run as  bundles in every GNOME system, no matter the distro.

Travis Reitter (developer of Empathy, Telepathy, Folks)  points out some of the advantages of JS.

  • Our language of choice needs to be dynamic and high level.
  • There is already momentum in the GNOME Project for JavaScript — it’s used in GNOME Shell and GNOME Documents.
  • There’s a lot of work going into the language to make it especially fast, embeddable, and framework-agnostic.
  • 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.
  • JavaScript is self-contained — it doesn’t come with its own set of core libraries, which makes it more convenient for us when integrating it into the platform.

C will remain the recommended language for system libraries and obviously Javascript is not the perfect solution for every situation.

What Changes

In theory nothing changes. GNOME will support all languages as normal, but it will prioritize JS.  However never under-estimate the power of the default. Actually Javascript is already the first class citizen in GNOME, since GNOME Shell UI plus all extensions are written in JS.

The most significant thing that changed is that GNOME finally choose -out of loud- a main technology for its platform.

Travis says:

  • We will continue to write documentation for other languages, but we will also prioritize JavaScript when deciding what to work on.
  • We will encourage new applications be written in JavaScript.
  • We will be working to optimize the developer workflow around JavaScript.

Gnomers also work towards to provide a GNOME SDK, and that pretty much means that documentation will be written primary for JavaScript. Do not miss to check out Travis post Answering the question: “How do I develop an app for GNOME?”

Developer Hackfest Status

More cool things happened there like various improvements in GNOME Toolkits and further discussions for Applications bundles and Application Sandboxing. Although there are some working demos (like gclick2), these plans are at their first stage and we won’t see something soon.

If you want to learn more just follow developers posts!

2013 will be definitely a good year for GNOME ;)

  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Adonis K. (Varemenos)

    That’s just awesome!

    • alex285

      In the UI is for GTK/Clutter, but you can access any GNOME lib with Javascript. For writing HTML/CSS you have to use GTKWebKit.

  • foobar

    Well. The funny part here is that the decision was just made by a few people on a hackfest. People are continuing not using javascript. It’s pretty much a decision which influences newcomers, third party developer an documentation. I wouldn’t be too hyped about it. The language is only useful for quite small projects anyway. (~10.000 lines)

    • alex285

      Short of a few people. Windows 8 using javascript for apps, Firefox OS uses javascript. It is nothing new or special. Also there are JS programs with more than 10.000. I guess the numbers, but for example linkedin services that uses JS, I just assume that are more than 10.000 lines of code.

      • foobar

        Yeah, for the web. It’s not like you have a choice over there. Dynamic languages are nice for prototyping, short apps, getting things done fast. But they terrible suck when it comes about maintainability / when a larger team is involved. Firefox OS isn’t a thing and I’m quite sure people are going to use something else as js for larger Metro apps as well.

        There are not even enough people in Gnome who use js. Quite hard to get help. However, there is a large set of possible quite small apps which are all about data representation. E.g. a thin layer around a data source which is all about displaying / interacting. This is what most mobile phone apps are doing. That’s where js might be handy. Well. And Plugin-Interfaces.

        Btw: Gnome Shell and gnome docs are pretty much C apps plus some lines of js. There is even more scheme code in Gnome as js.[1]


        • alex285

          I guess if you plan to make a large application, you will have the knowledge what you should use, and ofc you can go with C/C++ or whatever else, GNOME decision doesn’t affect you. But for new comers that want to make a simple game or an application like Bijiben, docs and support in JavaScript will be a huge gift. You might are familiar with compiling, auto-tools etc, but for most of us, these are just Chinese -or Greek for Chinese people:)

          • Craig

            You look a fool to people who have a clue and misinform people who don’t. What are you hoping to accomplish by running your mouth on the internet?

        • Eigenvektorz

          Re your first point: Linkedin’s mobile backend uses serverside JS through node.js. Also, do you agree that Firefox is a thing? Much of its front-end code is JS (with calls to C++). Also, Gnome Shell is a thing, too, right? It’s basically all JS.

          Finally, I wouldn’t trust Ohloh numbers to display anything accurately… ever.

          • foobar

            I’m a GNOME Developer by myself. It’s not like I don’t know the shell. I even contribute to some apps presented here and maintain my own product. There are different variables in software you can measure. Some of them are describing the amount of internal amount of dependence of various parts. Front end code usually has a quite low factor here.Our shell & firefox (without taking a look at the code) are very likely using that fact. That’s what a lot of games are doing: The core is developed in a static language and the (large amount of) thin code, like campaign & Quests are scripted in a dynamic language. And don’t get me started on how those parts are mostly tested. :)

          • Craig

            gnome-shell is hardly a large codebase. Most of the real work is done by Clutter/Mutter/Cairo/OpenGL/etc. It’s a nice project, done in tastefully written JavaScript, but JavaScript is still a shitty language. A person’s flawed decision to used a deeply flawed language doesn’t somehow make the language any better.

            Also, Node.js is a complete joke. Even it’s original creator doesn’t use it any more. It’s basically an experiment, turned hype machine, turned cash cow. Joyent know full well how crap it is. LinkedIn is a CRUD app. 99% of the work is handled by their database. The fact that a few hipsters on their team decided to use Node.js doesn’t mean anything. Again, pointing at some high profile company who was persuaded to use a shitty technology doesn’t make that technology any better.

            tl;dr: JavaScript is the Justin Beiber of programming languages.

      • Craig

        This “JavaScript-is-the-future!” hype is getting old now. We’ve heard the same list of nebulous “advantages” reeled out over and over. JavaScript won’t magically stop being a shitty language over night, evangelism or not. People who parrot this list really need to get a clue. Repeating it over and over only demonstrates that you value second hand opinions a little bit too much due to your own lack of first hand experience.

        Microsoft chose JavaScript simply because they’re are desperate and running scared. They figured the best way to make inroads into an already dominated market was to appeal to the masses of amateur JavaScript programmers that already exist. The vast majority of people who know JavaScript well will probably be the first people to tell you how much it sucks and how quickly they would stop using it if they had the choice.

    • JJ

      You are missing the whole point. This is a great initiative aimed at attracting new developers to gnome. Currently it is just impossible to contribute anything to gnome unless you already know c/vala etc. and documentation is close to nothing.

      > People are continuing not using javascript.
      You might be talking about big projects. You did not expect libreoffice to move completely into javascript, did you? It is very easy to find/get people who know javascript and if you make the docs good enough and ‘initial steps’ easy, there will be numerous gnome apps in no time.

      The current developers are not affected by this decision. Personally I am so happy and excited and might start/contribute to a couple of apps myself.

      • foobar

        No, I don’t miss the whole point. But most articles talking about it do. They are claiming it’s going to be the new primary language. However, that’s not going to happen. Javascript comes with the same troubles python has here. There is only a single py app left in core. And it’s currently moving away to vala. (gnome-clocks it is.)

        Heck, I even worn out your points in my later posts before you wrote yours. :)

        • alex285

          I think the whole point is for GNOME to make a platform that you will be able to build applications like Clocks inside a week, without having super programming skills. The second point is to attract new people.
          Javascript is a nice marketing trick (if you think so) but is more than this. Android, a mobile OS choose Java for its SDK.

          > However, that’s not going to happen.
          What for certainly doesn’t happen is people (no Gnome devs) creating new Gnome apps with Vala or C ;)

          • foobar

            Elementary, XFCE, Yorba, ….

            However, I’m leaving this discussion to get some work done. :) As a last note: I actually think the question is not Vala || js. Vala is rather a replacement for C and might work quite well together with js. (gjs needs some tweak for constructors & better support for generics. The first is a gobject/vala problem and the second one a gir thing.)

          • alex285

            Hey! You know the people of Yorba; and Elementary and XFCE are huge projects! Decrease a bit the standards :)
            Have fun with your pointers, cya!

          • Craig

            You keep talking about building apps “inside a week” and learning JavaScript “in 1-2 days”. Clearly you don’t have much experience with the realities of these things.

          • alex285

            Alright I haven’t and JS is the worst lanuage ever. Btw JS isn’t very much single threaded. You can fire events at anytime.

  • Philip Witte

    Sorry, but no thanks. Dynamic languages are not only much slower, but also less secure and more bug-prone. Javascript is especially bad with it’s prototype inheritance structure. It’s a disaster for larger projects compared to strong-typed OOP languages. Granted, the Javascript Gnome is running is much better than the Javascript Browsers run (which also makes it just as un-WORE today as native languages).

    Before you call me a naive, know that I spend my entire professional day developing a JS HTML5 game and have used JS in website design for years, I know the language well. I simply can’t understand why anyone would want to use it over Vala, Dart, D, C# or even C++ when they have the option to (Granted D and Dart aren’t really options for Gnome yet). Especially Vala, it was specifically made for Gnome and integrates very well. Why they would push Javascript over Vala I can only assume is due to fandom or ignorance.. no offence intended.

    I’ve really appreciated looking at the Elementary team’s work lately. They seem to be getting everything right from UI design to technical implementation.. even their code looks aesthetically pleasing, and it’s pretty much all Vala (to my knowledge) so it runs very well, even on dated machines.

    • Rowan Lewis

      They might not want it over Vala, or any other language, and that is kind of the point.

      I come from a background working with PHP, JavaScript and other web oriented languages but have struggled to find a way to contribute anything meaningful to the desktop. Giving some priority to JavaScript means that the documentation will finally be up to scratch and I should be able to write one or two small projects I’ve been waiting to write for years, but lack the technical knowledge and time to learn how to implement.

      Basically JavaScript is a gateway programming language to the GNOME desktop, it will help new developers and developers coming from different fields.

      • Philip Witte

        If you are still programming after dealing with PHP, then picking up Vala will be a walk in the park ;-P

        In all seriousness though, this sort of thing is more about good documentation than any specific language (granted you have good languages to choose from). Javascript or not, you’re still going to need to work with GTK, which isn’t HTML, and Gnome Javascript supports different JS features, so your existing knowledge isn’t fully translatable.

        • foobar

          I know about 3 people who actually thought about writing a PHP backend for vala to get rid of writing it directly. :D

          • Wat

            what is this I don’t even

    • maheart

      >> Dynamic languages are not only much slower

      In this case, Javascript is just a thin front-end to C libraries (either written in glib, or those with a glib wrapper). This is achieved using GObjectIntrospection. When you tell your GNOME Javascript to do pretty much anything, it calls C code. Not slow.

      >> Dynamic languages are not only much slower, but also less secure and more bug-prone.

      I assume this comment is based on the fact that static languages do bounds checking, type checking, syntax checking, etc at compile time. What’s often disregarded though is that languages like C, C++ and D allow you to play directly with memory and IMO this makes them more prone to serious errors like buffer overflows that lead to crashes and exploits.

      Vala/C# are fine static languages and don’t allow (AFAIK) direct memory access. Vala however is GNOME-only and would turn off a lot of developers. C# on the other hand has never been fully welcomed into the FOSS community.

      • Tpt

        Yes, Vala is a gnome only language but its basic syntax is very close to C# and have a lot of common things with Java, that is one of the most ever used languages. So, I think that Vala is not really a big gap for developers that knows Java or C#.

      • Philip Witte

        >> In this case, Javascript is just a thin front-end to C libraries

        Sure, so performance isn’t the biggest concern (even though all shell animations [to my knowledge] run through JS “Tweener” [unless that is a C wrapper too]), but Vala is virtually as easy to use as Javascript, and the Javascript you use in Gnome isn’t the same as the browsers, so it’s not like everyone’s existing knowledge translates over (Granted, Vala is ref-counted, so cyclic-refs is an overhead). I understand that OOP is a completely new paradim for some, but it would be better, IMO, to encourage more people to learn it over encouraging people to use a crappier alternative for the sake of familiarity.

        Don’t get me wrong, I think having Javascript bindings is a good things, and I think the Docs should be kept up-to-date. I just don’t think it should be the “recommended” language when there are better options. Mainly Vala. Especially for core Gnome Apps.

        >> languages like C, C++ and D allow you to play directly with memory

        Yes, I didn’t mention C for a reason ;-) and tried to address this with my statement: “even C++”. D is very safe though, but like Vala, allows advanced users to do advanced things (it’s not an option due to it’s lack of shared-object support, atm). IMO, all Gnome development that can be switched to Vala, should be switched to Vala.

        Vala is a Gnome DSL.. but that’s not really a bad thing, considering we’re talking about Gnome development and Vala is just OOC. Hell, the right marketer could really sell the fact that Gnome has it’s own language which makes writing apps both fast and easy.

        – “Life is easier in the Gnome-o-sphere.”

        • Craig

          Vala is a general purpose language. It’s not a DSL. People really need to stop misusing that dumb acronym.

      • Craig

        Marshalling can be slow. JavaScript is also single-threaded, so even 1 slow JavaScript operation in an inner loop can totally fuck up the party. Also, C is fast because it can be optimised via things like alias analysis and inlining. You can’t inline across language boundaries (without an FFI).

        What you say has some truth, but it’s a gross oversimplification.

    • sramkrishna

      They are pushing it because it has a much lower barrier of entry. We need apps. Without apps, there is no attraction to the platform. Just because we are using javascript doesn’t mean that you can’t use vala. In fact, it would be great if we can get volunteers to keep the documentation in Vala, Python and others in sync. More developers, more users, and hopefully more contributors.

      Secondly, as I understand it, ecma 6 is likely going to be really fast for our purposes. Python was considered and argued over till the final minute. The reason Python didn’t make it is because of inconsistency between doing something the python way vs doing it the gnome way. So for instance, you would likely use a hash table or some other thing using a python library instead of using it using the glib python bindings. If I recall it will open up to bugs. With javascript, you’ll use only the glib bindings and nothing else just like you would with C.

  • LukynZ

    Well, new browsers benchmarks: sunspider, v8, peacekeeper and gnome :D

  • Craig

    Lua is a much nicer, cleaner and more orthogonal language. JavaScript is a garbage heap of f*ckups and ECMAScript 6 is going to make it considerably more bloated and flawed.

    Fuck JavaScript.

  • leonel soriano

    continue to update vala?

    • foobar

      Vala is not affected by the decision. It’s more a replacement for C in small projects / Python in case the authors think it’s a good idea

      • leonel soriano

        a ok js for scripting. yeah is good idea :)


    Speed compare, JavaScript, Flash, Silverlight, C++, C#, ASM, Java!

    JavaScript is lowest