Polyglot programmer: which languages generate standalone apps?

I earlier reviewed a rich range of GUI programming environments for OS X. Before taking any of them on more challenging projects, my next question is which of them can produce a simple standalone app which displays a ‘Hello World’ alert, then quits.

One good indication of how complete a development environment is provided, and how easy it is to create a standalone app using it, is whether the environment itself is written in the language in question.

Xcode: Swift, Objective-C, and others

hwxcode1Xcode is the most sophisticated and complete tool for creating almost any form of app for OS X (and iOS, watchOS, and tvOS, if you wish), and can readily create standalone apps using Swift, Objective-C, and other languages which it can support. However it is not intended for quick, simple, and dirty apps: you have to go the whole hog and create a full-blown app.

hwxcode2It does support Playgrounds, which allow you to try code out, but those run in Xcode’s GUI, not their own. So if you want your own standalone app, you will find yourself assembling its storyboard and editing several Swift source files. For a quick hack, this can prove frustrating, and it is telling that it is hard to find simple Xcode Swift example projects.

There are several third-party tools to help design and implement the human interface: PaintCode 2 (App Store, ÂŁ79.99) generates Swift and Objective-C source code, and others can prepare images for use in Xcode projects.

AppleScript

hwapplescriptAlthough AppleScript starts to get messy when you need complex dialogs, it is supremely easy to create a simple alert, and to turn that script into a double-clickable app. The resulting app is also tiny, around 75 KB, but will of course only run under OS X.

LispWorks 7: Common Lisp

hwlispworksLispWorks provides excellent and clear examples of basic Hello World demos which show how you can implement this, using its common human interface, or using Cocoa more directly. Turning this into a standalone app requires some additional Lispery to generate the executable code and package ready to be run by a user, but in general this is fairly straightforward and just a matter of using the templates provided.

Haskell: Haskell

Currently, the Haskell app operates primarily in its Playgrounds. Future updates will make it easier to develop code in a Playground and then export it for external compilation. This will enable the production of standalone apps, but there is then the issue of providing a common human interface, which is not yet straightforward either. Hopefully in the coming months these will become clearer.

iMops: Mops/Forth

As iMops ships complete with its source code, there is a lot of information provided as to how to implement standalone apps. However these are not simple, so I ran away from trying to get to grips with what is involved. However, iMops is capable of building standalone apps with whatever interface you wish, including standard Cocoa. I just wish I had the time to explore it more to understand how.

Factor: Factor

I was impressed to discover that Factor has good support for creating standalone apps with their own human interface. As in LispWorks, this requires you to bring two components together: the Factor code to handle the interface and actions, and deployment specifications, which determine how the app is put together. It even offers a graphical front-end to building the deployment configuration.

hwfactor

Its manual is perhaps not as fluent in describing how to use these as I would wish, but it does deliver. Deployed apps start at around 500 KB in size, so they seem to carry a lot of overheads.

Others

DrRacket’s Racket/Scheme includes command-line tools for creating and distributing standalone apps, although they look fairly complex. It is better geared towards running apps within its own IDE, and in browsers.

APLX’s APL provides good support for simple interfaces, and a mechanism for generating standalone apps. I have not yet tested them under El Capitan, though.

Both Platypus and Pashua generate standalone apps from a range of scripting languages, although their code overhead is considerably greater than, for example, a regular AppleScript app.