I rewrote git-parse-commits from Python to Kotlin. Now you can compare:
- python: https://github.com/stepin/git-parse-commits/blob/1.0.2/git-parse-commits
- kotlin: https://github.com/stepin/git-parse-commits/blob/2.0.0/git-parse-commits.main.kts
The size turned out to be about the same (both in lines and in number of bytes).
Advantages of Kotlin:
- Strict typing: easier to write, read and maintain
- Better work with collections: easier to write, read and maintain
- Dependencies can be specified in the script file itself and they are downloaded by themselves (in Python this is a whole separate story with global packages or venv)
Advantages of Python:
- it is available by default in almost all Linux and macOS operating systems
- it starts quickly (instantly and 2 seconds in this example - it is already assembled and with downloaded dependencies).
- there is a feeling that he knows more people than Kotlin. Accordingly, it will be more comfortable for them to update the script.
Temporary disadvantages of Kotlin:
- you still have to keep the entire script in one file. It is blocked by the fact that
@file:Import
does not work in Kotlin 2.0.0 yet, we are waiting for updates. - it is unclear how to write unit tests. Similarly depends on
@file:Import
(to import the script file into the test file). So far, integration tests and debugging in IDEA. - it can potentially be built in native. Then it will run quickly, but the scripting will be lost (the source code in the file itself can always be viewed). This is a good option for cli-util. Now, again, it does not work with scripts, only with a regular Kotlin project, but, in general, a regular project is suitable for the cli. We are not waiting :).