Hacker News new | ask | show | jobs
by oleks 3060 days ago
Why is Oil implemented in Python? IMO Python is a terrible language for writing programming languages.
3 comments

I will address that in part 2 of the FAQ, but the short answer is:

1) I prototyped it in Python; the dependency on the Python interpreter will be removed [1]

2) Oil went through many implementation languages, and one incarnation was 2000-3000 lines of C++. But I realized I would NEVER finish that way. The goal is to be compatible with bash, which is a tall order.

3) Oil is heavily metaprogrammed. It's only 16K lines of Python, compared to 160K lines of bash, and it can run some of the most complex bash programs out there. [2]

It's more accurate to say Oil is written in Python + ASDL [3], i.e. somewhat in the style of ML.

[1] https://news.ycombinator.com/item?id=16277358

[2] http://www.oilshell.org/blog/2018/01/15.html

[3] http://www.oilshell.org/blog/tags.html?tag=ASDL#ASDL

If you expect the shell process itself to be doing a lot of CPU-bound work, then that might be a reason against using an interpreted language like python.

If you expect the shell process to need to make use of true thread-based concurrency, then that might be a reason not to use python.

Do we have either of the above expectations? What other reasons are there for python to be inappropriate?

Why?
Maybe because python is very slow?
For this to be relevant you'd have to explain that you expect the shell process itself to be doing a lot of CPU-bound work.
pypy gives decent speed, and RPython is quite impressive.

But I'm sure it is ease of prototyping and exploring the design space.