3 ms·
Portability between implementations is a nightmare, and you end up adopting only one. Its not overly different than the compatibility problems you hit between J
by shakna 10y ago
Portability between implementations is a nightmare, and you end up adopting only one. Its not overly different than the compatibility problems you hit between JPython, CPython, and IronPython.
Most Scheme implementations are cross-platform, and most issues you run into are the "extras" each implementation adds in.
Let me say this: most of my daily work involves programming in Scheme.
We investigated a lot of the top contenders, and ran into some rather random issues.
Gambit-C is damn fast. Its GC is amazing, and as the name implies, it cross-compiles to C. With a little tweaking, we got it running on some of the beefier Arduinos for some embedded work. Gambit includes custom namespaces for modules, which can make it easier to work with. However, documentation for Gambit is atrocious.
Guile doesn't support native compilation. You could compile down to the object code, and then write a C-wrapper for it, but it's painful working that way. (Also: Guile doesn't support the (void) function! They renamed it for no obvious reason.)
Chicken compiles down to native code, though its runtime is slightly slower than Gambit. It also implements a lot more SRFIs than Gambit, making it so you don't need to reinvent the wheel as much. However: the moment you add a package, Chicken can't compile statically anymore, and you need to build a distribution, and that gets rather hairy when you hit optional dependencies per platform.
All that being said, my work, for reasons I'm probably not able to explicitly go into, involves writing code that both Chicken and Gambit-C can run, and it isn't overly difficult, though I did have to reimplement some libraries that only one or the other had. Yet, in Scheme-land, that's half a days work.
- qwertyuiop924 10y agoNeat. Yeah, it's a lot better than it used to be. Oh, by the way, as somebody who primarily uses Chicken, you forgot about the coolest part: Chicken is slower than Gambit, but it does Cheney on the MTA compilation, which means that call/cc is almost free. Given, there are some other tradeoffs, but it's still pretty cool. Also, what kind of job are you in where you're writing Scheme code? That's totally awesome!
- shakna 10y agoGetting to use Scheme was almost an accident. We had a dual Python/C stack, where we basically had a prototype in Python, running for small clients, and then a better C one for embedded devices. We decided that was a bad idea, and went to rewrite the C for both consumer and embedded devices. However, the lack of progress had the manager investigating all kinds of things, like MicroPython. I had been playing around with Scheme in my spare time, and pointed out that Scheme was almost as fast as C, and almost as fast as Python for prototyping. They handed me a test to see if Scheme was suitable -> Rewrite our Python prototype in Scheme, within three weeks. Because of how consistent Scheme is, and how close Python's syntax is to it, it only took me three days. With the decent C output of Gambit's compiler, I wrote a script that modified it to work on our embedded devices as well, in another three days. The manager was sold, and our whole team moved to Scheme. I was very unpopular for a few months. As to the actual project? The little I can say, as it isn't launched yet, is that it's a kit designed for schools.
- qwertyuiop924 10y agoPretty cool. I can only imagine how unpopular you were, though.
- alexkarbiv 10y ago>I was very unpopular for a few months. Cython.
- shakna 10y agoCython simply wouldn't work. We were trying to streamline two products into one: * A C application that runs on an Arduino. * A Python application that runs on the desktop. Cython may make the Python implementation faster, but it hardly solves the distribution issues. There's a reason MicroPython exists (and it was one of the contenders!) Scheme became the product, because Scheme was easy to run on our hardware, and on consumer hardware. It was easy to develop with, fast to develop with, and runs faster than most high-level languages competing in this sphere. Cython certainly has its use cases, and is a fantastic bit of software. But it didn't fit ours.
- bad_login 10y agoIn what ways having call/cc for free is usefull? The use of call/cc i see in real programs i am aware of is green threads.
- qwertyuiop924 10y ago...mostly because it's so expensive. But you can use call/cc for all kinds of things: exceptions, python-style generator functions, delimited continuations, and famously, webservers.