From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.emacs.devel Subject: guile and emacs and elisp, oh my! Date: Wed, 14 Apr 2010 22:18:22 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1271277300 2072 80.91.229.12 (14 Apr 2010 20:35:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Apr 2010 20:35:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 14 22:34:59 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O29IY-0000T6-U0 for ged-emacs-devel@m.gmane.org; Wed, 14 Apr 2010 22:34:59 +0200 Original-Received: from localhost ([127.0.0.1]:60726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O29IY-0002hh-BS for ged-emacs-devel@m.gmane.org; Wed, 14 Apr 2010 16:34:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O290n-0001dp-LK for emacs-devel@gnu.org; Wed, 14 Apr 2010 16:16:37 -0400 Original-Received: from [140.186.70.92] (port=36259 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O290k-0001ak-P0 for emacs-devel@gnu.org; Wed, 14 Apr 2010 16:16:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O290i-00031l-7e for emacs-devel@gnu.org; Wed, 14 Apr 2010 16:16:34 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:63565 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O290i-00031b-4F for emacs-devel@gnu.org; Wed, 14 Apr 2010 16:16:32 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A56E5ABE99 for ; Wed, 14 Apr 2010 16:16:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=sasl; bh=nu9aiUjldDa+DE3vfYq3kO9PT rs=; b=sZZboIvQncbMXKqDZjHHd78tQ3J84j6BOKVveKl1kbqXlfnUY+Z5kG62j SXf89geKT4gOQ26LF6iNsn+SfcWKvYg66Dr3lLRCyBSmrRsXt9DjRke/PBYooXaO 2dR9a51jLDuMyJSG6DWl5mnKlNrInJ4RHHJL5uLDNdYXVuFAl4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=sasl; b=uGVP7PbKU9o+aNYBwyt SHReH8RBYURSgxbKgMptoUalTB+bH5F+RukigGr4QsxsrMBVe6aYZ9AO5jEQK6tk +rpUu3TX6IevPY8y5JpEYLvZN6NVvLuyZW2UgxK13qCV6CAfiLVkLTGIY0zb7Edd 9w45c+BpeIHMmW7ixLz7SlQU= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A1A43ABE98 for ; Wed, 14 Apr 2010 16:16:30 -0400 (EDT) Original-Received: from unquote (unknown [81.38.188.244]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id D421AABE97 for ; Wed, 14 Apr 2010 16:16:29 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 9D0BCB88-4802-11DF-9BB2-D033EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123666 Archived-At: Greetings, all! My name is Andy, and together with Ludovic Court=C3=A8s I co-maintain Guile. I meant to put off writing this note until some months in the future, but as people seem to be interested in the topic, now is as good a time as any. The topic? Emacs and Guile. (Cue cheering and derisions!) I'll be telling some history here, from the perspective of one who wasn't there, but I believe I have the essentials right. Emacs and Guile have a long and lovely history, longer in fact than Guile's existence itself. Hacking Emacs is the core of GNU -- as you know, Emacs is alive, it's fungible, it's free. The GNU system grew out of Emacs and the hack-experience that it represents. (I have a friend who regularly chides me when I have to reboot and shut down my Emacs -- it's like I'm killing a friend, he says!) But when it was decided that GNU should be like a Unix, it was a fall from grace, in a sense. The system no longer had the Emacs nature. Time passed, and people looked to see how to spread the Emacs nature from Emacs itself to the rest of the programs in the GNU system. One possibility would be to extract elisp from emacs and use it as an extension language. But given that the language would have to be extracted anyway, the thought was to use a more modern Lisp dialect, Scheme. Thus Guile was born, as the GNU extension language. (Its birth coincided unfortunately with the so-called "Tcl wars", but Guile was not made because of Tcl. Guile was made out of a need that existed outside the polemic. For example, Neil Jerram -- recently retired Guile maintainer, may he hack in peace -- mentioned to me once that he had contacted Richard quite early on, before the "Tcl wars", discussing the need for a GNU extension language, as Elisp was to Emacs.) But I digress! Tom Lord was the one to make the initial Guile, derived from SCM as you know, and though his time with Guile was too short, we are privileged to have traces of his code in Guile, and his ethereal presence here on this list. Since then, about 15 years ago now, Guile has had many maintainers. It was stabilized, and documented, and extended, and hacked, and fixed, but eventually we realized that Guile's interpreter -- which traversed trees of expressions to produce its effects and values -- was just too slow. We needed to do some pre-computation on the source; we needed to compile it to something. Given that the U is for ubiquitous (*not* Unique, all you salt-n-pepa fans), we couldn't do native compilation, not directly anyway -- we needed something portable. So, with the help of a few hackers, I updated some work that Keisuke Nishida did on writing a VM and associated compiler for Guile, and that's what we're going to release hopefully next month as Guile 2.0. We've been trying hard to maintain backwards compatibility for Guile, and we've done well, I think. The move from interpreted to compiled code has all of the eval-when pitfalls that you all know, but most extensions just compile fine with 2.0, and practically all correct Scheme code -- a number of errors were not caught with 1.8 and before -- practically all of that code runs fine without modification. If you really want the whole story, I'd advise you to see my presentation at November's GNU Hackers Meeting in Sweden, which can be viewed or downloaded here: http://wingolog.org/archives/2010/04/02/recent-developments-in-guile Hi! Still with me? Cool :) I've said all of this to give some credibility to what I'm going to say now. Guile can implement Emacs Lisp better than Emacs can. We can compile Emacs Lisp to Guile's VM, and make C shims to present a suitably compatible C interface to the rest of Emacs' C primitives. No one will notice! Except that after a switch, Emacs would be faster, more powerful, and have the ability to access all of Guile's facilities -- the Scheme language, other languages implemented for Guile (Javascript, Lua, ...), a proper ffi, dynamically loadable libraries, a module system, the numeric tower (rationals, bignums, etc), Guile's existing libraries, delimited continuations (!), fast bytevector access, native threads, etc. On a language level, I am convinced that not only can Guile implement Emacs Lisp, but it can provide a coherent story for tight interaction between e.g. minor modes in Javascript and Scheme and Elisp, etc. More details will come later, though feel free to bring up specific points. There have been some suggestions on the list that "Guile people want to rewrite Emacs in Scheme". Though Scheme does have some facilities to offer, personally I do not believe in rewriting software. I've failed enough times, thank-you-very-much -- and if we could retrofit a compiler into Guile in two years via correctness-preserving transformations, surely we can replace the implementation of Elisp without causing problems. My goal is to make it the obvious decision for the Emacs maintainers to say, "yes, let's switch to Guile's implementation of elisp, because it will make Emacs better and have no drawbacks". We're not there yet -- and that's why I wanted to put off this mail -- but we'll get there. I guess that's all I have to say, for now -- my bandwidth is not with Emacs right now, as there are enough things to take care of in Guile itself. But, I'll be responding to this thread, and lurking on the list, so do get in contact if you have a concern. In the meantime, happy hacking! Andy --=20 http://wingolog.org/