2 ms·
The point of my shell project Oil (http://www.oilshell.org/blog/ http://www.oilshell.org/blog/) is to get rid of the shell vs. Python debate. My claim is that,
by chubot 9y ago
The point of my shell project Oil (http://www.oilshell.org/blog/ http://www.oilshell.org/blog/) is to get rid of the shell vs. Python debate.
My claim is that, in general, X isn’t a good bash replacement, where X is Python/Ruby/Perl/JavaScript. I think that’s obvious to some people but not to others (typically X programmers who don’t know shell, which was me in the not-too-distant past).
This article is good because it has a port of a realistic port from shell to Python. But to me it only succeeds in proving the opposite point -- that porting to Python is a lot of effort, and the result has a lot of detail that doesn't match the problem domain. Error handling is possible, which is good, but awkward. And now you need external librariesl like psutil, then a package manager and special deployment tools for Python. (And you probably need some shell scripts to build/deploy your Python...)
One thing I don't see is the complete result, which from the looks of it is pretty clunky compared to the 20 or so lines of bash.
-----
About Oil: I realized that not everyone was getting the point of it, so I resolved to write an “elevator pitch” [2].
I haven’t published that post yet, but the pitch is: Oil is the language you can convert bash scripts to automatically, once they become a maintenance problem
That might happen at 50 lines for some people or 1000 lines for other people.
Oil will have a more uniform syntax [6], not 4 different sublanguages [3]. It will get rid of word splitting, and have proper arrays [4] and hash tables. It should be easy to write a test framework in it, as opposed to bash test frameworks like bats [5] which actually modify/extend the language because it's not powerful enough.
There are some cases where porting from bash to Python is a good idea. But I also had the revelation of porting Python to shell, and being relieved (e.g. more than one deployment script). I was a Python person and I came at it from the opposite side. Shell is really expressive, but it’s hampered horrible syntax and a bad/old implementation.
In summary, the conundrum of porting things back and forth between bash <=> Python/Ruby/Perl/JavaScript is why Oil exists. It seems like this debate will never end, and I hope that the “automatic conversion” property [6] is a unique argument in favor of Oil vs. X.
If anyone is skeptical of my elevator pitch I’m interested in the feedback :) You can also try the first release [7].
[1] http://www.oilshell.org/ http://www.oilshell.org/
[2] http://www.oilshell.org/blog/2017/07/31.html http://www.oilshell.org/blog/2017/07/31.html
[3] http://www.oilshell.org/blog/2016/10/26.html http://www.oilshell.org/blog/2016/10/26.html
[4] http://www.oilshell.org/blog/2016/11/06.html http://www.oilshell.org/blog/2016/11/06.html
[5] https://github.com/sstephenson/bats https://github.com/sstephenson/bats
[6] http://www.oilshell.org/blog/2017/02/05.html http://www.oilshell.org/blog/2017/02/05.html
[7] http://www.oilshell.org/blog/2017/07/23.html http://www.oilshell.org/blog/2017/07/23.html
- yorwba 9y agoThere is no [2] in your list of links. Does it refer to to the elevator pitch you included in your post, or did you intend to link somewhere?
- chubot 9y agoThanks I fixed it -- there is no real link #1 but I got lazy and didn't renumber all the links. In that post I promised an elevator pitch, but didn't write it yet. I just wrote it in that comment: Oil is the language you can automatically convert bash scripts to. It's exactly what everybody in this thread is debating. I think the debate won't end because both bash and Python have deficiencies for a very common set of tasks. I guess this set of tasks got more important with cloud and containers and whatnot. Feedback appreciated :)