views:

610

answers:

6

I would like to develop a graphical application in Common Lisp or other Lisp dialect that could be deployed in Mac, Windows and Linux as a way of improving my knowledge of this language. Ideally:

  1. would compile the code
  2. would use a common graphical library
  3. wouldn't need installation of the runtime environment.

I would like to make a little game or graphical app, and to be able to show it with a simple installation in a computer with any of these operating systems.

Someone has experience with similar situations or could point me to best choices of graphical libraries and compilers, runtime environments, etc...

Thanks!

+7  A: 

Most Common Lisp implementations can dump executable images. Sometimes these are two files (kernel + image), but often this can be just one executable. But the executable usually runs only on the platform it was compiled for. Commercial implementations like LispWorks or Allegro CL have extended capabilities - for example one can remove unused parts of the Lisp system. This is called 'delivery'.

There is some information about LispWorks applications. LispWorks is commercial and covering platforms can be expensive. You would have to buy the development environment - delivery is free on popular platforms. LispWorks has a graphical library for Windows, Mac and Unix/Linux. The latter is based on the oldish Motif. The advantage is that the code can be very portable over platforms. The LispWorks development environment itself is a LispWorks application. On the Mac for example the 32bit version and the 64bit version runs on both PowerPC and x86 from a single application.

Information about 'free' versions of Common Lisp and libraries is collected on CLIKI. Writing MS Windows applications is not the strongest part of 'free' Common Lisp, though.

Rainer Joswig
+3  A: 

PLT Scheme can do all that you ask. The library it uses out of the box is WxWindows, but you can get bindings for other GUI systems if you really want to.

PLT Scheme is probably the Lisp with the most work done on making it easy to write and distribute "a little game or graphical app." They include many examples of games in the base distribution and their flagship IDE DrScheme is written in their own graphics framework. It is free to create and distribute compiled PLT Scheme code on any platform.

Edit: You asked for any Lisp dialect. Would Clojure also be an option?

Edit 2:

You said that Clojure is an option. If you are already very familiar with Java and Swing, I think that Clojure would be a good way to go -- with the caveat that it's got some pretty big syntactic differences with other Lisps. A book is forthcoming.

If you aren't already a Java expert, I think PLT Scheme would still be the best choice. I am coming at this from the "just beginning to learn Lisp" and "small demo application" angles. Other people have noted that commercial Common Lisp implementations support what you want, but those will be harder (and more expensive) to use as introductory systems.

All of these implementations have macro systems, which I think is what you mean by "code is first-class."

Steven Huwig
OK, downvoted because it's not Common Lisp I guess. The question asks for any dialect.
Steven Huwig
whups, my mistaken reading. PLT is a good system. Some common lisps are far beyond it in terms of delivering commercial software, etc. though. CL is a well thought out industrial programming environment, after all. So I guess it depends what OP needs.
simon
Yes, Clojure and PLT Scheme are options too. I don't know much about the differences, but one important feature for me is that code is First class, like in Lisp.
alvatar
It's downvoted because you wrote that 'PLT Scheme is probably the Lisp with the most work done on making it easy to write and distribute a little game or graphical app'. Is that the case?
Rainer Joswig
I have experience programming java, so clojure might be a good options. Is it suitable for mid-size applications? For example, if the demo grows in size is it still suitable?
alvatar
@Rainer: I think the presence of the games package in the distribution, the included DSLs for animation, and the one-click package creation reflect the PLT group's commitment to that particular use case.
Steven Huwig
@Álvaro: probably the biggest downfall of Clojure in that respect is that it is a new language, and thus the definition is still in flux. If you want to take advantage of features added later, you may need to update old code.
Steven Huwig
Steven, LispWorks and Allegro CL also make it dead easy to develop graphical applications and deliver them. A lot of work has been invested in these features and to make them easy to use. For example into the GUI designer of Allegro CL. MCL was the easiest of all of them.
Rainer Joswig
Sure, but their documentation and examples are targeted for a different use case.
Steven Huwig
Hmm, I have a LispWorks here. There is an example directory capi/applications/examples/. What do you think files like chat-client.lisp, hangman.lisp, maze.lisp, othello.lisp, pong.lisp might be about?
Rainer Joswig
Fair enough. Maybe my real prejudice is that it would cost the original asker quite a bit of money.
Steven Huwig
Although I didn't state it in the question, I would prefer if it is an open-source solution.
alvatar
+3  A: 

Rainer has a good comment on the fundamental issues: There are good commercial solutions doing exactly what you ask (but they are not free development environments, and may involve recurring fees), with well supported cross-platform libraries. There are also free software approaches, but it is more difficult to deliver on all three platforms as you require (not impossible, but more fiddling about).

I will add though that "not installing the runtime environment" is a bit problematic. You certainly don't need to have the end-user separately install a lisp, but your program may well need to essentially install the entire runtime in order to work, depending on what you do. The flexibility at this level means it can be difficult to programatically determine what bits are and are not needed, which is why the free software solutions usually don't bother with the somewhat tedious and tricky work of writing a tree shaker to do this.

simon
Delivering the environment with my app is ok, I just wouldn't like to force the user to make a full install on his own
alvatar
+1  A: 

There is ECL, a Common Lisp implementation that seems to do what you want (I have not used it yet, though).

Svante
+10  A: 
justinhj
Wow, very nice. That might very well be the thing that makes me give LISP another try.
jfclavette
+2  A: 

What I'm doing presently, for a graphical application that uses OpenGL and GLFW, is developing primarily with SBCL, and giving my testers deliveries via cl-launch. However, my plan is to use CCL to build an application bundle on OS X, and ECL to build a stand-alone executable on Linux and Windows. The bundles I'm building at the moment with cl-launch are fairly large (typically 30M and up), while the tests I've done with ECL have been much smaller (libecl weighs in at about 1.3M on my system). However, I would expect SBCL to perform better (though I'd profile to make sure, first!), so your choice will depend on your application.

However, if I were doing this commercially, I would invest in one of the commercial implementations. Rainer Joswig mentions LispWorks and Allegro above. For Windows app delivery, you can also consider Corman Lisp. My impression is that the fastest but most expensive route to doing application delivery across those three OSes is to buy Allegro, but an alternative (more work, but cheaper) would be to use CCL on OS X, Corman on Win32, and ECL or SBCL on Linux. LispWorks seems to be a choice in between, although many people swear by it, so I wouldn't discount it as inferior to Allegro just because it's more affordable.

The graphics library issue is something separate; my impression is that the situation is constantly improving (callbacks in CFFI seem to work on most platforms now, which is a big help in interfacing to most C toolkits), but I've been working more with GL, GLFW, GLUT, and SDL (though not yet with lispbuilder, mentioned by justinhj above, which looks cool). I did experiment a little with wxCL a year or two ago, and it seemed promising.

The nice thing about CL is that, with so many good implementations, you can develop in your implementation of choice, and most of your code should be easily ported to whichever implementation you choose for application delivery on a given platform.

Julian Squires