> Hi folks, I'm hoping someone can help a me, a scheme newbie, choose my > scheme implementation for a project. (I've done ClojureScript, and am now > learning Scheme and lisp in general). What I'm not clear on from my > perusing of the chicken sites is what limitations the fact that chicken > compiles to C introduces. I'm building a music composition in Max/MSP, and > I want to host a scheme environment in a C plugin using the Max SDK. My > goal is to write high level composition related code in scheme, with only > the ugly max plumbing in C, as it's a rather low-level SDK. One aspect of > this is that I want users of the plugin to be able to send scheme code, as > files or strings, from max (passing through the C plugin) into the scheme > instantiation for evaluation, giving us a REPL-in-max essentially. I've > been looking at a few options: Guile, S7, Chez, and Chicken right now. I > feel like the ability to generate C as output could be really useful, but I > don't understand what I lose from Chicken's design for this case. (Boy I'd > love to hear "nothing"!) So any help on that or pointers to resources > would be much appreciated.
Hi! It all depends, of course. Since CHICKEN generates C and you want to talk to a C API, I'd think that it would be more than adequate. I don't know anything about Max/MSP, so there might be constraints that can make a choice difficult. Is this on Linux? Mac? Windows? CHICKEN will run on anything, but Windows makes things always a bit awkward - nothing that can be solved, of course. Do you need multiple threads? CHICKEN's runtime system is inherently single- threaded and there is nothing that can be done about it. You might want to to take that into account. Performance? If you use a lot of abstractions, things can get slow, if you keep your code tight and take some time to learn how to write fast Scheme code, then I see no problem. Compiled code in CHICKEN can be quite efficient, but needs to go through a C compiler, there is no runtime-compilation as in Chez. Perhaps you just build + configure objects to be executed in the Max application, but perhaps you have callbacks from the main application into your plugin that has to be fast? CHICKEN's C interface is powerful and comprehensive, you won't find many Schemes with more convenient means in that regard. Also, this is at compile time, so code you sent through to a REPL will be interpreted, but can invoke compiled Scheme code, of course, where there is no interpretation overhead. The Scheme heap grows + shrinks dynamically, but how you map C-level data to your Scheme plugin is a crucial design decision. There are facilities to help you with tying foreign objects into the Scheme memory management, like finalizers, GC-roots, etc. This is low-level stuff, but doable. One advantage is that CHICKEN has no dependencies, and it is usually straightforward to integrate code compiled with it into another application. It's also very portable, so with some effort, your plugin may run on multiple platforms supported by Max. CHICKEN doesn't have particularly powerful debugging facilities, that should be kept in mind. Particularly in C plugins, one straddles the boundaries beween C and Scheme a lot, so it is advisable to get some experience understanding the code that the Scheme compiler produces. There exists a bunch of extensions that you can use, so you won't have to start from scratch, if you take care not to include dependencies that don't play well with Max/MSP. Sometimes integration/build of external code may need some extra steps, depending on how you want to deploy your plugin. All that is doable and whether it is easy or hard depends on the constraints that developing a plugin for a large application involves. I have done this myself and it can be everything from trivial to hellishly complicated. Perhaps the most important factor: there is a bunch of people using CHICKEN that are always eager to help, should you need it, whether it's basic Scheme questions or whether it's about arcane CHICKEN internals. We have used it in big and complex applications, in plugins, in commercial products, on all sorts of platforms, so ask on the mailing lists or in #chicken on freenode if your need assistance. We can't debug your code, of course, but we can try to explain nearly anything about CHICKEN itself. If you already have some experience with one of the other Scheme implementations you mentioned, then I would advise you to use the one you know. If not, then CHICKEN might be the right choice, if you need seamless C integration, and if you are willing to accept that one has to get acquainted to a Scheme implementation to use it optimally, especially when interfacing with a complex piece of software. So I'd start from the following basic questions and look what you need: - what are your performance requirements? - do you need (OS-level) multithreading? - are debugging facilities needed? - is portability an issue? - how much effort you want to put into this? - what are the build/deployment constraints? If you need further advice regarding these points, please feel free to ask. felix
