Code by Kevin, Programming, code, business, and other pursuits
Kevin Walzer, software developer.
Subscribe to RSS Feed
Get a syndicated feed of my weblog.
Site design: Skeleton
For some time I've been seeking to add another programming langauge to my toolbox, which already includes Tcl and Python and their bindings to the Tk GUI toolkit; C and Objective-C; and AppleScript. Part of my reasoning for this is to keep expanding my programming skills; different languages can have different approaches to solving various problems, and getting some exposure this can make you a better developer. Also, languages have specific strengths, and not all languages are equally suited to solving a specific programming problem.
The language I've had my eye on is Ruby, a scripting language similar in many respects to Tcl and Python, but with some differences as well. Ruby has a rich set of libraries and extension packages, better in some respects than Python's, and a complete set of bindings to the Tk toolkit, which make it a good choice for desktop applications. Additionally, Ruby is an increasingly popular language, so the community surrounding it is large and growing.
Unfortunately, I've found that Ruby has a fatal flaw that prevents me from embracing as a suitable language for desktop development on the Mac: no deployment tools. There's no simple, actively-developed way to take a set of Ruby code, bundle it up with the standard Ruby interpreter and supporting libraries, and release it to end users as a standalone Mac application. All existing options are unsuitable: they are Windows-only (OCRA), do not support current versions of Ruby (rubyscript2exe and crate), or are based on an immature Mac-specific implementation of Ruby that does not yet fully support all features or libraries of the language and is incompatible with Tk (MacRuby). Python and Tcl have multiple ways to deploy a desktop applications, but Ruby has no viable way on the Mac, and this is deeply frustrating.
My initial response to this fact was to attack the problem in classic open-source fashion: roll my own. I started working on an app launcher that would intialize the Ruby interpreter, set some appropriate variables, and start the app. However, this approach eventually grew into a sprawling Rube Goldberg construction that piled ugly hack upon ugly hack. Eventually I decided this approach was untenable. Also, when I posted a mailing list inquiry about whether anyone else had interest in my project, it met with no response.
As a result, I began casting around for a different language. And it didn't take me too long to settle on a new one: Perl.
Perl was once the world's most popular scripting language, an enormously powerful but difficult-to-learn language with special strengths in text processing, and with a huge development community that contributed many, many extension packages for the language. Many other scripting languages take inspiration from Perl in one form or another, especially Ruby. While I had looked at Perl previously, I found that its focus on text processing didn't match what I was working on at the time, its dense syntax made my head hurt, and it didn't seem to have much of a constituency for development of desktop apps, particularly on the Mac.
However, my experiences with Ruby have prompted me to take a closer look at Perl, and, somewhat to my surprise, I have found that it meets all my Mac-specific requirements:
Up-to-date bindings to Tk (Tkx).
Support for responding to AppleEvents (Simple AppleEvents).
This is very heartening, rather surprising, and surpasses Ruby by a mile (classic Ruby also has no built-in mechanism for responding to AppleEvents or AppleScript).
So I think I'm going to be diving into Perl a bit more, trying it out, and developing a simple application before moving on to something more sophisticated. And, with some regret, I'll be leaving Ruby behind. But I'm excited to add Perl to the toolbox. Look for more discussion later.