DEV Community

Discussion on: Looking for scripting language

Collapse
 
mcsneaky profile image
McSneaky • Edited

Rust: it seems to compile cross platform quite well, it's really-really fast, it results in single binary, but learning curve is quite long (heard it can take years to be productive in it), is it worthwhile to learn and will it really take years?

C: Since it used to be my main language years ago I looked into that too, but it kills productivity lil bit too much. Maybe I should just brush up my C skills and stick with that?

Golang: This GO_PATH thing drove me crazy, I'd like to keep my code where I want it to be, like: ~/Projects/Some-Project/migrator etc. Not have all Golang stuff in one place ~/go/ JS code in other place etc. Also heard it's cross compiling is really bad compared to Rust

C# / .NET core 3: Got cross compiling and everything working quite well, but single binary is quite big (about 30mb for simple hello-world).

Python: Requires some additional tooling to get it into single binary + it bundles runtime into it like C# and makes bundle size big

JavaScript: Same as Python

Maybe there is some other language that I have not looked at all? From those mentioned Rust, Golang and C# seemd to be something to go for

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

I don't think you're going to find a decent option that doesn't bundle the whole runtime into the binary. The problem is that you need that if you want it to be truly independent of the host system, because otherwise you have to depend on whatever the target systems happen to have installed. Keep in mind though that that's a (mostly) static overhead. The bigger your tool, the less that matters.

You might also want to look into Python's support for packages/scripts bundled as ZIP files. If you can ensure a consistent Python version and all the libraries being installed on each target system, you can bundle all the files for a script into a ZIP file, name the main one __main__.py and put it at the root of the ZIP file, and then just invoke the ZIP file like a Python script. Supported by both 2.7 and recent 3.x versions. Relevant documentation is here. Obviously this won't work for double-clicking on a script from the GUI, but given that you're talking about automation you should be able to bundle the ZIP file into a script itself that just works (either as part of a shell archive for UNIX-like systems, or an executable for Windows using a small C stub program that should never need to change).

Collapse
 
mcsneaky profile image
McSneaky

Aah, that seems to be quite interesting, didn't know you can package stuff like this. Not a Python dev and this PIP package management has always been pain imo. Will look into it :) Thanks!