Lisp or a pre-processor?

https://news.ycombinator.com/item?id=5031980
by demallien • 14 years ago
3 4 14 years ago

We see many (many!) items on HN talking about the advantages of Lisp, but as is noted in nearly every Lisp thread, Lisp has never really been able to gain much traction.

In those discussions, Lisp has two wildly touted advantages: 1) it is a functional language, encouraging programmers to avoid state. 2) Lisp macros are a powerful tool that allows programmers great power in creating control structures.

These are definately two significant advantages, but the come with a couple of equally large inconveniences. 1) Lisp does not have the same quantity of libraries that you can find for other languages, and 2) there just aren't a lot of Lisp programmers out there.

My current solution to try and square the circle is to use a mixture of a higher level language (typically Lua or Javascript) with a good tool for generating bindings to low-level C code. This is a very productive solution, but it does introduce a performance penalty (although this has been getting smaller as time goes by).

This has lead me to start pondering about another solution - creating a custom version of C with a programmable pre-processor to convert it to standard compliant C. This introduces the same sort of flexibility that Lisp macros provide, and can even make concurrency problems easier to handle by making it easy to introduce Erlang-style actors.

Has anyone on HN gone down this path already? If you have, how did it work out? What were the pitfalls? And what system did you use for parsing your custom C?

Related Stories

Loading related stories...

Source preview

news.ycombinator.com