A universal scripting language

Developers often use scripting languages for common tasks and utilities outside the main program language or compiled executables. For example, Git is a popular C program that uses numerous Python scripts for utility functions. Scripting is commonly used where it’s burdensome to implement non-core functionality in the main project language. There can be a runtime speed penalty for scripts, which is why popular utilities may eventually be recoded in the compiled project language.

As in spoken and written language, there is no one scripting language that will suit all environments. Nonetheless, there are scripting language choices that more closely meet universal applicability with today’s computing environments. When thinking of long-term reproducibility, scripting is also a factor to consider.

For example, Perl, Python and Ruby are long-popular scripting languages that aren’t installed by default on Windows. Powershell is installed by default on Windows and is available on MacOS and Linux, but not installed on the latter two by default. The default shell varies between operating systems and distros. For development-oriented work, I have come to use CMake scripts instead of Python for tasks that CMake is a better fit for, such as finding and executing programs.

I don’t think there will practically ever be a universal scripting language, as the language would have to be universally installed by default across operating systems and distros to be immediately useful. Instead, we can have practical scripting languages targeted toward specific communities. For example, where a project already requires CMake and the scripting task is a good fit for CMake script, it may make sense to put utility scripts in CMake instead of Python for example. This can be true even for mixed Python-CMake projects. Sometimes we default to put every script in Python, when it may be easier and make more sense to put a subset of scripts in CMake instead.

CMake scripts are executed with (optional) options like:

cmake -Dvar=value -P myscript.cmake