|
|
|
|
|
by enriquto
1969 days ago
|
|
> As soon as you deal with concurrency, things either get hard to learn or get super messy. Strong disagree. There is a language where concurrency is trivial and beginner-friendly. It is called POSIX shell with standard GNU tools. To run several independent commands in parallel, you print them and pipe to GNU parallel. If your concurrency has an arbitrary tree of dependencies, you print it in the form target : dependencies ; command
and then run GNU make.Languages that make this simple stuff complicated, like Python, do so by choice, not by need. |
|
E.g. start two long-running commands and then close the one of them depending on some later output of the other one or vice versa.
If that's not already complicated enough, we can easily add things like, execute a command A and then another other commands (B, C, D) and, only once all these are finished, run a cleanup command D. But run D always, no matter wether B, C, D fail (think of closing a database connection). And now treat this whole thing as yet another command E, that itself can be used in the same place as e.g. B or C or D before (= composition).
Shell is great for many common tasks, but I would never call it beginner-friendly, even less "trivial to use for concurrency".