Hacker News new | ask | show | jobs
by nicoburns 1505 days ago
Regarding the "I wrote it in bash so it doesn't add a dependency". I've been thinking recently that it might make a lot of sense for these kind of tools to be written in a compile-to-native language (e.g. Go or Rust), and embed a lightweight scripting engine (for example quickjs or luajit).

That way they could write everything in a much nicer language and still not require a dependency. For such simple scripts the relatively low performance of these embedded scripting engines would be a non-issue, and you could even provide domain-specific utility functions (e.g. for shelling out, sending http requests or otherwise interacting with the system) implemented in the the host language (Rust/Go) with full access to their library ecosystems...

2 comments

I don't think there's a much nicer language when it comes to system configuration than a shell. I'm not sure why people want to write an extensive, complex program in a full-on programming language for simple tasks for which the shell and it's utilities were literally invented. The shell does a great job for managing your system already, and so far I've never had a better experience by making using a more complex language.
The problem with Lua at least is that in order to do anything remotely useful you will have to pull in a bunch of 3rd party libs from luarocks or somewhere. There's basically nothing in the stdlib at all except primitive functions to build on. At least with bash the host system _is the stdlib_. And you can usually rely on that.