Ask HN: Smallest cross-platform language runtime?

4 points by schemescape ↗ HN
For mostly command line tools, but ideally with some GUI support, what’s the smallest (and easiest to deploy) language runtime?

Rationale: I often write little tools, and often I need to run them in the future (frequently on different computers). I’d like to use C#, but getting a tool chain and development environment is a painful multi-gigabyte commitment. Today, I like Deno for its trivial deployment and smallish (80 MB) footprint (and VS Code+TypeScript is a great development environment, although not very small), but I’m not sure it will be around for the long term. Node is similar, but much more painful to setup.

Zig’s compiler (another smallish download) is intriguing, but it’s probably too low level when I only run the programs a few times a year (meaning I don’t want to write low level, fast code—-I’ll trade speed for ease of writing code or small footprint).

Tcl/Tk seems promising (I’ve heard it can be as small as a few megabytes). Any reason I shouldn’t use Tcl?

I’m sure there’s a Lisp option, but I haven’t found one with as small of a footprint as I thought should exist.

11 comments

[ 1.3 ms ] story [ 36.1 ms ] thread
Go can easily cross compile and has lots of OS level abstractions. I would use web tech for any frontend, run a server and embed the necessary files in that binary.

Go can be just a few MB onto the low 10s

I have very little experience with Go, but I recall setting it up was trivial and it compiled very quickly.

My only concern is that I’ve heard the language is simple to the point that it requires writing a lot of code that wouldn’t be necessary with something higher level (similar to Zig, but at least no manual memory management and Go’s channels sound great).

Good suggestion!

Edit: I also just remembered that my other experience with Go was the template library used in Hugo. I recall that being a negative experience, but hopefully something I’ll mostly be able to avoid.

I would say Go has minimal syntax, so yes there is a lack of syntactic sugar, but it also has a great stdlib. What is there is really well done and the tooling is fantastic
I didn’t mention a standard lib being important, but it most definitely is, and that’s a big plus for Go.

The lack of a standard lib is certainly JavaScript’s biggest weakness. Deno provides one, but I’m not certain it will stand the test of time.

I'm building a tool on top of CUE and Go's text/template library. My opinion is that the problem is more how Hugo organizes and combines files, lots of magic if you don't know how it makes decisions, kinda like CSS rules being opaque.

https://github.com/hofstadter-io/hof

Agree that Go, among some others (Vlang, Dlang, Nim), that are both compiled and use a GC (the GC of some languages are optional and can be turned off) could be on the list of what's looked at.
Is the 100KB TCC an option? posix+windows

https://en.wikipedia.org/wiki/Tiny_C_Compiler

https://www.lua.org/download.html is only a few hundred KB

TCC is great, but the C “standard” library is a mess (and huge, and inconsistent across Windows and Linux). Zig includes a C compiler and C library in a convenient package. But my main issue with C is that it’s just not productive. Dealing with strings in C is a chore.

I also like Lua, but the last time I used it (admittedly 10 years ago), the closest thing to a standard library was minimal. Maybe worth another look, thanks!

How about Forth?
Just for the record (and since it might not be clear from the title, due to the character limit), I'm not just looking for the smallest footprint--more like "best bang for the buck".

I'll give Forth another look, but in the past I found the language to be difficult to read and modify.