[ prog / sol / mona ]

prog


A lisp that doesn't suck

13 2018-11-16 23:18

>>12
Of course Lisp is easy to implement, but implementing a robust, efficient, standard compliant Lisp system is not. Even getting the first two in any language is a real achievement. Python, a language with a reference implementation instead of a standard, can barely manage the first two.

For those unaware, Python's GIL, global interpreter lock, is why thread level parallelism is impossible using Python's standard library's 'threading' module. Getting true multi-threaded support without a performance drop on single-threaded applications is too hard to implement, so Python can only run one thread at a time. Programmers familiar with green threads are probably unsurprised by this, although I'm sure they're imagining an improved scheme where Python allocates green threads onto OS threads and each OS thread has a kind of local GIL on the green threads it owns. The weird part is, Python doesn't use green threads! As of 2016 (I think), and perhaps still today, it instead works in an ass backwards way. Every thread in Python is an OS thread, but every OS thread except one is blocked from running. This means you get none of the speedups of parallelism, but all the cost of context switches. You can make multi-threaded Python code faster by turning off CPU cores. This has been measured. https://www.dabeaz.com/python/UnderstandingGIL.pdf Python is a internationally known language taught in esteemed universities and used everywhere from web shops to research facilities and consulting firms. It took a lot of work to reach the embarrassingly bad efficiency Python has now.

Writing a lisp is a similar goal to building a game engine. You can learn some interesting techniques and make someone go "oh cool, you wrote a toy lisp" but never produce anything of real merit or value.

Of course implementing a simple Lisp is fun, and fun things don't need to be justified. Just don't confuse liking something with enjoying building knock offs of it. And don't be the guy who never used the real thing and claims their knock off will be better than all those things they never bothered to learn about. Talk about NIH.

21


VIP:

do not edit these