Thursday, June 29, 2006

XPCOM Lisp (or XPCommon Lisp or XPLisp or Mozillisp or Mozilisp)

For over a year now I've had this idea of a lisp interpreter embedded in Firefox (or more generically Mozilla). It seems the more I think about it, the better it might be.

Presently, Mozilla uses Javascript as the "glue" between XPCOM components, XUL, and whatnot. Why couldn't Lisp (or some variant) be used as well? You could send some Lisp code to an XPCOM component and it interprets it for you, with access to other XPCOM objects. AutoCAD has AutoLisp...I would have a hard time imagining that a Mozilla equivalent would be completely useless.

To compound things even more, I found another reason why it might be good: the GUI. Lisp seems to be stuck (for the most part) in the text-based world...except for HTML applications and a few others. However, a Lisp XPCOM object could take advantage of XUL for buttons & widgets, which is handled quite nicely in a cross-platform manner. Indeed, with an XPCOM Lisp interpreter, the whole thing is cross platform...no porting necessary. One could even set up a Mozilla-based SLIME & Emacs editor (has this been done?), so the Lisp code creates Mozilla-based applications from a Mozilla-based editor & interpreter.

From what I know, it seems like there are two approaches to this method:
(1) Create a replacement for XPConnect that interfaces Lisp directly to XPCOM objects.
(2) Use the exisiting Javascript system to communicate with a Lisp XPCOM object by passing strings which contain Lisp functions.

I'm thinking (2) is a much better/simpler/more elegant solution, although there may be some limitations that I'm not aware of.

Are there any showstoppers in the idea, or is it just complicated/hard?