I need to develop an app which should look kind of the same on desktop and as a website incarnation.

Since I am a web dev and have never developed for desktop, I want to use a language that can embed a webkit view so I can use the same HTML/JS front-end for both usages, and minimize the learning curve for GUI at least.

C++ and Java can both use webkit, however, I am looking for alternatives where functions are first-class citizens, because I prefer prototype-based languages by far.

Long Version

I am mainly a web developer; I'm at ease with js/as3/php/python.

Lately however, I had ideas that need other languages to get done. Namely, I have an idea for a software that is part custom-database and part GUI. So I began tackling desktop oriented languages such as Java and C++.

I discovered Java is basically super-easy and C++ kind of ok (though it gets complex when I try to use GTK and the docs are sparse and dispersed). I can use this; one thing bugs me though: As fond as I am of PHP as a project and as a community, I've grown a dislike for imperative languages and find myself much more at home with ECMA-style languages. I was happy in web dev lately with the rise of node.js and how I could begin developing server-side functionality with javascript.

My question

I need a language that has the following features:

  • Functional. By "functional", I mean a large definition. This includes any language where functions are first-class citizens (where "actions" are more important than "actors").
  • Portable: I picked C++/GTK or Java because of easy portability and no license restrictions. So portability here means os-independent (with realistic limits) as well as open license.
  • Can use a webkit view:(like in GTK,or in Java) or similar; I intend to leverage my knowledge of web apps to build a beautiful, usable, gui in html5. The same interface will be used in the online version of the app. Therefore, I need the language to have a way to embed and interact with HTML5
  • Can use JS: ideally, through V8, although rhino or a similar tool is ok. If a window js object could be exposed to the js code (so I can use standard libs such as jQuery), it would be perfect.
  • Low-level: I need the database part to be fast. Could code my db in C and my GUI in whatever-language-it-will-be, but ideally, I'd like to use one toolset for both
  • Less important, but: if the language could be a derivative of ECMA script, so I can leverage my js skills, it would be cool.

My Current Options

  • Titanium, which has all the above features and uses js as it's primary code; However, I dislike being tied to a particular SDK and I'd rather use independent open-source libs that I can read.
  • Your suggestion?
  • 2
    Titanium looks like an object-oriented language. I don't think functional programming means what you think it means. Dec 1 '11 at 23:46
  • I am not very strict on the meaning of functional language. What I mean is a language where functions are first-class citizens (like js). And this is not the titanium I mean. I will edit my question and add the correct links
    – Xananax
    Dec 1 '11 at 23:51
  • 2
    You probably shouldn't use the phrase "functional language" in your question, spell it out explicitly and say "language where functions are first-class citizens", or else you won't get the answers you are after. Dec 1 '11 at 23:58
  • thing is most people don't really understand "prototype-based", plus I don't really care about the prototyping part, what I do care is that they are functional in the broad sense, like described here: stackoverflow.com/questions/3962604/…. I edited my question as per your suggestion nonetheless.
    – Xananax
    Dec 2 '11 at 0:11
  • Not really an answer but if you have a look at the Qt project there's a whole massive WebKit library built into it. Dec 2 '11 at 16:13

While it is significantly different that Java, C++, JS, whatever else I propose Clojure, a Lisp dialect. It is functional in the true sense. It also is dynamic. Since it is running on the JVM you should be able to use a webkit view since you have access to Java libraries.

The syntax probably looks pretty foreign but it is rather simplistic really and does satisfy your requirements.

Rhino, an open source implementation of Javascript in Java. You can use it and still have access to Java libraries though I am not entirely sold on some of the examples. The site shows that reflection is required to create a Java array from Rhino which feels clunky in my opinion but that is only my opinion. Again though like Clojure you get access to Java libraries which will fulfill the webkit view desire.


I propose Common Lisp.

  • Common Lisp is multi-paradigms so you can do functional programming.
  • Common Lisp is portable, there is a lot of implementations that works on various systems.
  • There is cl-webkit and there is also many libraries to use Gtk.
  • You can use Parenscript to translate Common Lisp to JavaScript.
  • Common Lisp can be really fast if you know how to use it, and if you don't the implementations are good enough to produce good code.

PS: I'm a new user so I can't post more links, but you can look at cliki.net to find the gtk libraries.

  • +1 for the recommendation, however, if using a lisp why not go with Clojure (as @Rig said) since it would provide direct access to any of the Java libraries?
    – Jetti
    Dec 2 '11 at 16:48
  • Because I don't know Clojure very well and because there is ABCL a Common Lisp that runs on the JVM and thus you can access to the Java libraries.
    – Daimrod
    Dec 2 '11 at 23:27
  • 1
    From cl-webkit README: "Note, this is alpha software. Do not use." Jun 12 '12 at 20:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.