Tags Lisp

There has recently been a lot of buzz in the hacker blogosphere about the deficiencies of Common Lisp, peaked in Steve Yegge's post Lisp is not an acceptable Lisp and this discussion on comp.lang.lisp initiated by the Common Lisp veteran Ron Garret.

In one of the numerous comments, I ran into a mention of newlisp - a curious little dialect of Lisp that's aimed at the "scripting" market - to compete with Perl, Python, Ruby and friends. I took some time to browse the website, downloaded an played with the implementation, and asked some things on their forum to learn more about the language. My first impression is quite positive.

However, the dwellers of comp.lang.lisp treat newlisp with dismission at best, and with disgust and mockery at worst. They point to the following as the deficiencies of newlisp (this probably is a partial list):

  1. The name. Oh, how much the name newlisp infuriates them. The claim is that newlisp is not in any way more advanced than Common Lisp, so the prefix 'new' is wrong and misleading. There is, in fact, truth to this claim, and the newlisp fans agree that the name causes them problems.
  2. The memory management model is very unusual, without a garbage collector per-se. This is achieved by passing arguments to functions by value, allocating large chunks of memory and managing it internally. Mark-n-sweep garbage collection is used only during errors. Generally, I haven't yet found any empirical proofs of the pros or cons of this approach. Despite the criticism, newlisp is quite fast for an interpreted language.
  3. The default scoping in newlisp is dynamic. Indeed, this is a serious deficiency. Lexical scoping is supported in a specialized way, however, through the concept of "contexts".
  4. There is no auto-transition from fixnums to bignums. Only 32-bit integers and floats are supported (on 32-bit systems). Generally, I don't see this as a show stopper - Perl, for instance, also lacks default bignums, and newlisp has a ready-to-use binding to GMP.
  5. newlisp's macros can't be used for compile-time optimization, as they are expanded at runtime exactly like functions.
  6. Support for OO is very rudimentary and "patchy" - akin to Perl 5's OO.

On the other hand, there are quite a few advantages:

  1. Probably the most important - a tiny footprint. All you need to deploy a newlisp script is its 170Kb interpreter. To embed it, use the 180Kb DLL.
  2. The language is portable and cross-platform
  3. Despite its unusual memory management, newlisp is fast. It measures very favorably against the mainstream scripting languages - Perl, Pyhton and Ruby.
  4. PCRE (Perl Compatible Regular Expressions) that works out of the box
  5. Graphics with Tk out of the box. The tiny footprint plays another role here - the Tk-aware newlisp interpreter is only 1.4Mb in size, and it's all you need to run swift Tk applications on all platforms.
  6. A lot of useful and functional libraries, out of the box. TCP/IP and UDP networking, MYSQL and SQLite access, CGI, FTP, HTTP, XML, XML-RPC, Matrices, statistics, Unicode and more.
  7. Bindings to C / C++ code trivial - very simple to load and use a C++ DLL. This helps bind popular libraries to newlisp (like GMP for arbitrary-precision arithmetic) and optimize tight pieces of code in pure C.
  8. Macros are functional and can be used to extend the language and write DSLs.
  9. Very active development. newlisp quickly closes the gap from the other Lisp dialects. Its code is open (GPL) and looks well managed, the documentation is detailed and tidy, and the implementor is open minded for new ideas and improvements.

(There's a page on newlisp's website listing the differences from other Lisps)

Curiously, the slogan of quite a few newlisp enthusiasts are "newlisp - because programming is fun again". Recalling the claims of Steve Yegge and Ron Garret, I can't help but think - what if they are right ? newlisp certainly is a dialect of Lisp, with everything we love in Lisp - functional programming, support for lists, automatic storage management, dynamic typing, first class functions, uniform syntax, interactive environment, extensibility through macros. Add to this loads of useful libraries that come out of the box, the simplicity to bind to other libraries just-in-case, the small memory footprint, and you have what looks like a fun language. It also looks like a language with a future, that is being actively developed and improved, here and now. Most of the criticism of newlisp is about things that are simple to amend, and I have no doubt they will be fixed in time due. It doesn't make newlisp any less usable until then, though.

Sure, it is inferior to Common Lisp and Scheme from a theoretical viewpoint. But people are writing real applications in newlisp and are enjoying it. Besides, I'm sure it can only do good to the Lisp community, since it may introduce more newbies to the language. I don't think anyone will disagree that newlisp is much more newbie-friendly than either CL or Scheme.


Comments

comments powered by Disqus