Programming Language Fragility
- Published
- Last updated
- 2023-01-19 01:52 UTC
Suggestions and corrections: cancel@cancel.fm
How fragile are the products of programming languages? If you write some software in a particular language, can you copy the compiled program to another computer and expect it to work? If the internet stopped functioning, would you be left helpless?
| Language | Portable by Default | Portable with Effort | Notes |
|---|---|---|---|
| C | No (libc) | OK | |
| C++ | No (libc) | OK | |
| Rust | No (libc) | OK | Requires no_std. Most of the Rust ecosystem will be unusable. |
| Go | Partial (needs flags) | OK | Pass some flags to build a static binary |
| Pascal (fpc & Delphi) | OK | OK | |
| Zig | OK | OK | |
| Nim | OK | OK | |
| Odin | Partial (static libc) | OK | Pass some flags to build with static libc, or use more effort to omit libc |
| D | No (libc) | Partial (static libc) | On Linux, musl may be statically linked instead of glibc. |
| Haskell | No (libc) | Partial (static libc) | Complex build process to statically link runtime libc. Must avoid using libgmp features. |
| OCaml | No (libc) | Partial (static libc) | Complex build process to statically link runtime libc. Win32 requires cygwin. |
| Swift | No (no Win32) | No (no Win32) | |
| Java | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime (with licensing issues) |
| C#/F#/.NET | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime (with licensing issues) |
| Python | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime |
| Ruby | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime |
| Perl | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime |
| JavaScript (Node.js) | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime |
| Scheme (Racket) | No (complex runtime) | No (fragile bundling) | Complex and fragile bundling of a separate runtime (with licensing issues) |
| Lua | No (custom binary) | Partial (custom binary) | Must build custom binary of the runtime plus your program code bundled together. |
| Tcl | No (complex runtime) | Partial (custom binary) | Must build custom binary of the runtime plus your program code bundled together. |
What about the compilers themselves? How likely is something to go wrong when acquiring or setting up a compiler?
| Compiler/Interpreter | Portable | Notes |
|---|---|---|
| gcc | No | Requires installer or package manager. Heavy environment entanglement. Multiple executables. |
| clang | No | Requires installer or package manager. Heavy environment entanglement. Multiple executables. |
| msvc | No | Requires installer. Heavy environment entanglement. Multiple executables. |
| tcc | OK | |
| Rust | No | Requires installer or package manager. Recommended installation method is to pipe curl into bash. |
| Go | OK | |
| Free Pascal | No | Requires installer or package manager. |
| Delphi | No | Requires installer. |
| Zig | OK | |
| Nim | No | Requires a C compiler. |
| Odin | OK | |
| D | Partial | Multiple executables. Some environment entanglement. No installer required. |
| Haskell | No | Requires installer or package manager. |
| OCaml | No | Requires installer or package manager. Requires cygwin on Win32. |
| Swift | No | Requires installer. Heavy environment entanglement. Mac only. |
| Java | No | Requires installer or package manager. Multiple executables. Licensing issues. |
| C#/F#/.NET | No | Requires installer or package manager. Multiple executables. (Mono, .NET, and .NET Core) |
| Python | No | Requires installer or package manager. Heavy environment entanglement. Multiple executables. |
| Ruby | No | Requires installer or package manager. |
| Perl | No | Requires installer or package manager. Heavy environment entanglement. |
| JavaScript (Node.js) | No | Requires installer or package manager. |
| Scheme (Racket) | No | Requires installer or package manager. |
| Lua | OK | Rolling your own host executable is required. |
| Tcl | OK | Fully portable via tclkits/all-in-one binaries. |
Bonus round: portable compilers that can build themselves, portably.
| Compiler/Interpreter | Builds Itself Portably | Notes |
|---|---|---|
| tcc | OK | When using musl-libc. No Win32. |
| Go | Partial (needs flags) | Requires some options and configuration. |
| Everything else | No |
Some additional notes from readers:
- Chicken Scheme is capable, apparently, of producing portable executables: https://wiki.call-cc.org/man/5/Deployment
P.S. I've been working on some indie shareware: if you use Slack but don't like the default browser-based client, give Ripcord a try.
