?

Log in

eyes black and white

Why I haven't jumped ship from Common Lisp to Racket (just yet)

Matthias Felleisen jested "Why are you still using CL when Scrbl/Racket is so much better :-)" ? My response was as follows:

Dear Matthias,

you are right Racket is so much better in so many dimensions. I use Lisp because I just can't bear programming in a language without proper syntactic abstraction, and that is a dimension where Racket is far ahead of Common Lisp (CL), which sadly also remains far ahead of the rest of competition. Racket also has managed to grow a remarkable way to mix typed and untyped program fragments, which sets it ahead of most. But I am under the impression that there are still many dimensions in which Racket lags behind other languages and Common Lisp (CL) in particular.

  1. The Common Lisp Object System (CLOS) has multiple-inheritance, multi-methods, method combinations, introspection and extensibility via the MOP, generic functions that work on builtin classes, support for dynamic instance class change (change-class, update-instance-for-changed-class) and class redefinition (defclass, update-instance-for-redefined-class), a semi-decent story for combining parametric polymorphism and ad hoc polymorphism (my own lisp-interface-library), etc. Racket seems to still be playing catch-up with respect to ad hoc polymorphism, and is lacking a set of good data structure libraries that take advantage of both functional and object-oriented programming (a good target is Scala's scalaz and its rival cats).
  2. While the ubiquity of global side-effects in CL is very bad, the facts that all objects that matter are addressable by a path from some global namespace and that live redefinition is actively supported makes debugging and maintaining long-lived systems with in-image persistent data more doable (see again CLOS's update-instance-for-redefined-class). This is in contrast with the Racket IDE which drops live data when you recompile the code, which is fine for student exercises, but probably wrong for live systems. CL is one of the few languages that takes long-term data seriously (though not quite as seriously as Erlang).
  3. Libraries. CL seems to have much more libraries than Racket, and though the quality varies, these libraries seem to often have more feature coverage and more focus on production quality. From a cursory look, Racket libraries seem to often stop at "good enough for demo". An effort on curating libraries, homogeneizing namespaces, etc., could also help Racket (I consider CL rather bad in this respect, yet Racket seems worse). My recent experience with acmart, my first maintained Racket library, makes me think that writing libraries is even higher overhead in Racket than in CL, which is already mediocre.
  4. Speedwise, SBCL still produces code that runs noticeably faster than Racket (as long as you don't need full delimited control, which would requires a much slower CL-to-CL compiler). This difference may be reduced as Racket adopts the notoriously fast Chez Scheme as a backend (or not). Actually, the announcement of the new Racket backend really makes me eager to jump ship.
  5. As for startup latency, Common Lisp is also pretty good with its saved images (they start in tens of milliseconds on my laptop), making it practical to write trivial utilities for interactive use from the shell command-line with an "instantaneous" feel. Racket takes hundreds of milliseconds at startup which puts it (barely) in the "noticeable delay" category.

All these reasons, in addition to inertia (and a non-negligible code-base and mind-base), have made me stick to CL — for now. I think Racket is the future of Lisp (at least for me), I just haven't jumped ship right yet. If and when I do, I'll probably be working on some of these issues.

PS: Here are ways that Racket is indeed vastly superior to CL, that make me believe it's the future of Lisp:

  • First and foremost, Racket keeps evolving, and not just "above" the base language, but importantly *below*. This alone makes it vastly superior to CL (that has evolved tremendously "above" its base abstractions, but hasn't evolved "below", except for FFI purpose, in the last 20 years), and superior to most languages (that tend to not evolve much "above", and not at all "below" their base abstractions).
  • Racket is by far ahead of the pack in terms of Syntactic abstraction
  • Racket has a decent module system, including build and phase separation, and symbol selection and renaming.
  • Racket has typed modules, and a good interface between typed and untyped modules.
  • Racket has lots of great teaching material.
  • Racket has a one-stop-shop for documentation, though it isn't always easy to navigate and often lack examples. That still puts it far ahead of CL and a lot of languages.
  • Racket provides purity by default a decent set of data structures.
  • Racket has many primitives for concurrency, virtualization.
  • Racket has standard primitives for laziness, pattern-matching, etc.
  • Racket has a standard, portable, gui.
  • Racket has a lively, healthy, user and developer community.

I probably forget more.

Comments

No way, es tu?

Fare,

Great write up and response. I have been encouraged or rather advised in the past to drop CL and move to Clojure that it is the future of Lisp. I hesistated and like you, with large code base or addiction, its hard to do. I decided to continue adding to my lisp code rather than convert it to another language i will have to learn. Its a risk, but i am willing to risk it if my product is good. I primarily use SBCL and generally okay with it.

Thanks for your great CL tools and libraries. BTW, why can't we rather make the language more modern instead of running away from it.

Jeosol

And Clojure?

What do you think of Clojure as an alternative to CL for example?

Wow

Mr Rideau,
This was a very surprising post for me. You having done so much work for Common Lisp libraries recently, I found the title strange and I concluded it must have some irony in it. But it turned out this was not the case. Obviously this means Racket is a more complete language than I thought it to be.
Selfishly, since I am heavily invested in the language, I hope you will continue working on Common Lisp, because you make its ecosystem better.
>Racket is by far ahead of the pack in terms of Syntactic abstraction

Not true, http://www.red-lang.org/ is beyond, with not only cross-platform but also native GUI, native cross-platform with no intermediate steps compiler, zero dependencies all in 1MB language. Decent I/O, Concurrency few other things are yet to come, it is in active development.

And from my point of view is one of the superior lisps.
eyes black and white

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Tags

Powered by LiveJournal.com