6 ms·
> But it's just that a general purpose programming language like Python doesn't treat executing subprocesses in enough of a first-class manner, That's my gener
by btschaegg 10y ago
> But it's just that a general purpose programming language like Python doesn't treat executing subprocesses in enough of a first-class manner,
That's my general impression on scripting, too. Shells are great at doing day-to-day things I want to do interactively on a system, but start to develop problems (awkward syntax, lacking readability etc) when it comes to more complex programming. On the other hand, languages like Python do that really well but have problems with the first part.
I sometimes wonder if there's really no way to combine the two in a practical way. One datapoint (on the negative side) would be Powershell, which (as a more recent shell) gives its user very useful tools but still fails (IMO) on the syntax front.
An idea I pondered on for a while was that maybe a shell-specific notation could help. Take xonsh, for example. The concept of it is something I could get used to, but I can't really get around the fact that there's some magic involved in differentiating between shell and python commands[1].
Perhaps a more modal approach (think vim) could help? Say I can switch explicitly between python- and shell-mode (avoiding all the magic) and can write shell-constructs in a script in a dedicated notation (like JS has its own notation for regexes, for example). Then, the main problem would most likely be the interaction between both modes (i.e. how one can pipe the stdout of a subprocess to a variable)...
[1]: http://xon.sh/tutorial.html#python-mode-vs-subprocess-mode http://xon.sh/tutorial.html#python-mode-vs-subprocess-mode