Serializable Emacs Objects

Christopher Wellons over at null program has a very nice post on readable closures in Emacs. With the introduction of lexical scoping and, consequently, closures in Emacs 24 it's nice to discover that Elisp closures are readable. That is, you can print them and read the resulting text back in to create an object that is equal to the original.

The post is a bit more general than the title suggests. It provides a list of Elisp objects that are readable and another of those objects that are not. I don't think I've ever seen that information written down before so it's very useful. For example, as of Emacs 23, Emacs hash tables are readable. That's something I didn't know. Actually, Emacs does a better job of serializing its objects than Common Lisp does. As Wellons explains, a lot of that has to do with the fact that Elisp compiles to byte code.

Even if you aren't interested in closures, this post is worth reading for what it tells you about serialization in Emacs Lisp.

This entry was posted in General and tagged , . Bookmark the permalink.