schani/clojurec — pull request #34 by bertfrees (2014-01-17 19:59:27+00:00)
Title: Some changes I did for my ClojureC REPL project

While playing around with ClojureC it occured to me that it would be cool to have a REPL for it. It seemed like a fun challenge and I gave it a shot. You can see where I am now at https://github.com/bertfrees/cljc.repl.

When I started, I hadn't seen the other effort from @ghubber yet, who tackled the problem by implementing a metacircular evaluator in ClojureC.

I didn't even think that far, I just did what seemed the most straightforward to me. The only way I knew how to dynamically generate and evaluate C code is to make a shared library and `dlopen` it. It may seem a bit brutal to make a library for each form you enter in the REPL, but the advantage is that it was fairly easy to implement, and you get "the real thing": everything you enter is actually compiled down to C. As far as I understand, in the metacircular evaluator approach there is no compilation involved, am I right?

Also, it seems to be reasonably fast.

Tell me what you think. And keep up the good work!

Cheers,
Bert