4 ms·
This looks interesting as a code generator, but I fail to understand how it can be useful to lisp programmers. After the code is generated, there is no easy way
by coliveira 18y ago
This looks interesting as a code generator, but I fail to understand how it can be useful to lisp programmers. After the code is generated, there is no easy way to call the C-compiled function, other than manually running a C compiler, then using whatever foreign method call method is available in your lisp version. That is: it sucks almost as badly as writing the C code manually. Am I missing something crucial here?
- s3graham 18y agoI guess if you don't have a Lisp environment for your target, it could be somewhat better than having to write C code directly (because you could more easily generate it with macros, etc.)
- shiro 18y agoI'm using similar technique in the Scheme implementation Gauche. Gauche compiles Scheme into VM instrunctions, but VM itself, some foreign bridges, and performance-critical pieces are in C. I started from plain C, then gradually moved to C-in-S-expression. Here's my experience: * As others pointed, ability to use powerful macros are huge relief compared to the crude macro of C. * I can manipulate a piece of C code (in S-expr) programmatically. For example, I can automate VM instruction fusion (create a piece of code that combines two or more basic VM instructions). * I can mix Scheme code and C code more naturally, allowing me to micro-tune inner loop and/or reducing overhead of FFI. Of course, if you have really good native Lisp compiler on your target platform, you won't need this kind of stuff.