How do the various ANSI CL implementations differ?

2019-01-31 17:07发布

问题:

When I started learning CL from Practical Common Lisp, as is preached in the book, I started off with Allegro CL compiler. I stopped using it, since its commerical, yet free bit didn't impress me. It needed a connection to its remote server for some licensing stuffs.

I switched to 'clisp' and am using it. Now, I have been hearing about SBCL and planning to start using it as well.

So, the question is: How do the various ANSI CL implementations differ? Any practical experience of using one over the other ?

Thank you.

回答1:

There are portions of ANSI CL that leave certain details up to the implementations to determine; you will find that for those parts of the standard, each implementation will have its own quirks.

Also, look for things that are important to the runtime but not defined in the language: things like threading and multiprocessing and garbage collection will vary substantially in performance and reliability.

I have found SBCL to be the easiest implementation to work with in Linux; it has good support for threading in Linux. I can't say much about the garbage collector, because it hasn't mattered to me much yet.

On Windows, your best bet will probably be Allegro or LispWorks, although I've had some success with clisp on Windows. The Windows port of SBCL is progressing, but I haven't used it much, so I can't really comment.

Generally speaking, an understanding of these kinds of things that are difficult to acquire through research or analysis; it comes through experience. Just pick a decent implementation that you're comfortable with, and get to work. You'll figure out the tricky stuff as you go.



回答2:

See Common Lisp Implementations: A Survey by Daniel Weinreb.



回答3:

If you are on a machine that can run SBCL, you should use it. It's the fastest free Lisp compiler (it can generate code that is as fast as Haskell, OCaml, Java, C, and C++, which are all very very fast, especially compared to Python and Ruby). It also is a fairly complete implementation, and supports most of Swank's features (for SLIME), which is nice when you are developing.

As some of the other comments mention, you won't really notice any differences when you are first starting out. All the free CL implementations are "fast enough" and support all the features you'll need. But if you start writing production software, you will appreciate SBCL's features. OTOH, there's really no reason not to switch now.



回答4:

I have been looking at Win32 solutions to the same question. As far free Lisp implementations on Windows, I would strongly recommend Clozure CL (CCL). There are several reasons for this. The first is that Clozure supports 32- and 64-bit binaries. It's very fast, and somewhat compact. But most importantly, it's consistent and correct. I find it to be an extremely mature Lisp, after working with Lispworks (which I miss) for several years. CCL does a very nice job with native OS threads, sockets, and some other elements that are not part of the CL spec. Its implementation of CLOS seems to be extremely thorough. And it's GC and memory management are excellent. I compared CCL to SBCL on Win32, and while SBCL was a bit faster on several benchmarks, it cons'd up a lot more, and its image kept growing and growing, even after several forced GCs. Meanwhile, CCL was consistent, small, quick, and lovely to use. And if you want a platform that's consistent across Windows, Mac, and Linux, and has both 32- and 64-bit support, then look no further.

I did try CormanLisp on Win32, and there were many things about it I liked. But it does not run properly on 64-bit Windows platforms, and is limited to Win32. It's also not free, and somehow I had it crash on me when I'd throw some garbage code at it. I also was easily able to make SBCL crash. Not so with CCL. Rock-solid. Really, those guys did an amazing job, and ultimately will help keep Lisp alive.

As for SLIME, I didn't try to get SLIME working with SBCL, but I did get it working nicely with CCL. No matter what your fancy is, I advise that people write code to be easily portable. Aim for Windows, Mac, and Linux, and aim for 64-bit. If you consider these, then CCL is your best choice overall.

A last attempt at an answer to this is to consider what is wrong with the others. Here's what I've come to find:

  • CLISP is nice, but is far slower, relative to SBCL or CCL. I see little upside
  • SBCL seems poor on Win32. Image size can get big.
  • CormanLisp is good on Win32, but not portable, and does not support Windows x64. It also seems that Roger Corman is not actively developing CormanLisp, which is a shame, but it's the reality.
  • Clojure (with a "j") is not Common Lisp. As nice as it may be, I think that if you already know CL, then it's not worth the overhead of learning Clojure's many differences. I'm sure some may pick them up fast, but I surely did not. (If Java-compatible code is what you're after, then look at ABCL).

dave



回答5:

I don't know enough to give you a detailed answer, but I noticed that SBCL was considerably faster then Clisp when I was working with CL for my AI class. Unless you have a compelling reason not to, I'd suggest going with SBCL.

I've heard that Clisp is easier to install and is more portable than SBCL (which has lots of processor-specific optimizations), but if you're using Linux they're both easy enough to fetch from the package manager.



回答6:

I found the error messages in clisp to be more friendly and help me find the problem faster.



回答7:

It seems that SBCL's REPL is not friendly compared with clisp ? E.G. I can use TAB key to auto-complete input in clisp.

so clisp is a better for lisp newbie.



回答8:

I've had pretty good luck with installing clisp using cygwin if you're under windows.



回答9:

Depends on your OS of choice

  • Windows - use ecl or abcl
  • Linux - use sbcl or ecl or abcl or cmucl
  • Mac - ccl or ecl or sbcl
  • Other - abcl or ecl or sbcl

EDIT:

Sbcl on windows lacks threading and is, in general not that stable, and none of core maintainers use windows.

ecl is much better choice for cross platform lisps, its feature set is equaly stable on all major platforms.

EDIT 2011-10: Sbcl windows now has threading support. It is not yet fully merged in mainiline, but there is a fork which is pretty stable which have threading and other Windows specific goodies.