5 ms·
There's one case missing: Build a command-line tool with concise and maintainable code; Performance is not important. Scala Native would win over Rust and Go,
by tanin 9y ago
There's one case missing: Build a command-line tool with concise and maintainable code; Performance is not important.
Scala Native would win over Rust and Go, which are too low-level. Scala Native would win over python/ruby because of the ease of deployment (e.g. compile to target CPU) and static typing.
However, Crystal probably wins over Scala Native...
- walkingolof 9y agoGo is probably a winner for the time being for CLIs, just the fact that I can cross compile for 3 platforms with a very simple script makes it very attractive.
- koolba 9y agoSpecifically it can cross compile to a static executable. It’s quite pleasant to just copy a compiled Go program and have it just work.
- asdjlkadsjklads 9y agoYea, this is now a requirement for me on any future languages i use. Coming from Py/Node, single executables blew my mind.
- tanin 9y agoI agree. Golang is the winner at the moment because it supports compile to Mac, Linux, and Windows. The deployment of golang app is just so good (no extra installation) that I can ignore its lower level of abstraction. Other native languages should be able to do the same in the near future (I hope).
- pjmlp 9y agoOther native languages are able to do the same since ever.
- pnloyd 9y agoI think that the Docker CLI bring written in go is some pretty big counter evidence to saying go is to low level to write CLIs. I can't think of a single reason that would be true.
- pjmlp 9y agoActually, regardless of the endless discussions we might have about its features, I would say that thanks to Docker and Kubernetes, it already won the hearts of many sysadmins.
- tanin 9y agoI wasn't clear about "low-level". I mean "lower level of abstraction". Lower level of abstraction often means higher amount of detail programmers have to take care of. For example: 1. Rust is on a lower level of abstraction than Go is. Because, in Rust, when we use strings we have to think whether we should use `String` or `&str`. In many types of applications, we just want a string. We don't care which type of a string we need. It's too much detail. 2. Golang is on a lower level of abstraction than, say, Ruby on the aspect of error handling. Maybe, for a command line tool, I don't want to explicitly handle exception on every statement. I just want it to exit if an error occur. It's too much detail. 3. Python can be thought of as being on a lower level of abstraction than Ruby. For example, in Python, there are 3 ways of getting the first element of an array or null (https://stackoverflow.com/questions/363944/python-idiom-to-return-first-item-or-none https://stackoverflow.com/questions/363944/python-idiom-to-r..., well, which one is better?) In Ruby, the function is already encapsulated in main library (e.g. `.first`), and people don't have to care of this kind of detail.
- pjmlp 9y agoI would rather use OCaml for it, there are even published books how to do those kind of tasks with OCaml. https://ocaml.github.io/ocamlunix/ https://ocaml.github.io/ocamlunix/ And it has an eco-system that goes all the way back to 1996.
- tanin 9y agoI'm not familiar with OCaml. Its syntax looks like a high-level language (which is good). Can we compile code into a single binary and run it on a user's machine without any extra installation? Does it work with Windows?
- pjmlp 9y agoYes, all languages in the ML family compile to native code. OCaml can also compile to bytecode, usually used on the REPL or just to speed up the development cycle. Your single binary might depend on glibc by default. If you want a pure static library then you need to customize the toolchain to use another C library like musl. And yes, it does work on Windows.