If you're building an application, then your users will get much more out of it if you given them a plugin API. For Sublime Text, I settled on Python as the extension language. In fact, I think you'd be mad to choose anything else.
For a desktop application looking for an extension language, the two most important things to optimize for are the likelihood that your users will create plugins, and the chance they'll actually enjoy it. This gives a few guidelines when choosing an extension language:
- Adoption matters. There should be a reasonable chance that users already know the language, or if they don't, learning it is at least a worthy investment.
- Unicode matters. How much depends on the application, but if users can't even write a script that opens a file in their home directory because of Unicode issues, you won't be winning any friends.
- Libraries matter. File access, date / time, socket programming, subprocesses, etc. If you're writing a general purpose desktop application, then most plugins your users will want to write will involve using APIs other that what you've explicitly exposed.
- Ease matters. Any language requiring a separate compilation step isn't a contender.
There are also several criteria that don't matter for a typical desktop application extension language:
- If you're going to depend on the scripting language having fast runtime performance, then Python may well not be for you: Lua or Scheme are both typically much faster, and have a lower memory footprint.
- If you're depending on the language for security, such as a web browser running untrusted code, or a server running code submitted by users, then you have an entirely different set of considerations.
- If the application is only going to be used in house, then it doesn't matter terribly much what percentage of users are familiar with the language, because they're going to be forced to use it anyway.
At first glance, it appears that desktop application developers are spoiled for choice of extension languages, but caveat programmer:
Scheme, despite having reasonable libraries and Unicode support, is far from mainstream. Using Scheme or another Lisp dialect as an extension language is an effective way to make sure you won't have any extensions. Early versions of Sublime Text used Scheme as an extension language, but it was dropped for this reason. Just because you like a language, doesn't mean your users will.
Lua is another candidate, which has a lot of uptake in games. It has a very small code footprint, and excellent runtime speed. However, its paucity of libraries, weak Unicode support, and small-medium user base make it hard to justify as an extension language for desktop applications.
We come to Python and Ruby. Which language is better really isn't relevant, both are fine languages with pleasant syntax and semantics. In terms of ecosystems, both are popular and have a good selection of libraries. Python, however, is the bigger gorilla, with a larger user base and more libraries.
Python, however, has a secret weapon: Python has ctypes, and Ruby doesn't (1). ctypes provides an ad-hoc way to call functions in any shared library in the system. This means that the platform's entire native API is available with no C extensions required. Take, for example, a user who wants to launch another application, then set the input focus back to yours. With Python and ctypes on Windows, it's only a few lines of code to call GetForegroundWindow and SetForegroundWindow. That's pretty awesome.
Summary: Your users will be happiest if you choose Python. It's pretty hard to argue with that.
1. Not strictly true, as pointed out in the comments, Ruby has a similar library called Ruby/DL 2. That's pretty cool.