From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: emacs and guile (Re: ehelp woes, or why I hate a module that I love so much) Date: Thu, 18 Jul 2002 17:45:34 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: References: <20020704135240.4CBB.LEKTU@terra.es> <20020704164911.4CC1.LEKTU@terra.es> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1027028790 27877 127.0.0.1 (18 Jul 2002 21:46:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 18 Jul 2002 21:46:30 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17VJ6S-0007FW-00 for ; Thu, 18 Jul 2002 23:46:28 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17VJIX-0000bp-00 for ; Thu, 18 Jul 2002 23:58:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17VJ6R-0003kc-00; Thu, 18 Jul 2002 17:46:27 -0400 Original-Received: from 208-59-178-90.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([208.59.178.90] helo=raeburn.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17VJ5d-0003iz-00 for ; Thu, 18 Jul 2002 17:45:37 -0400 Original-Received: from kal-el.raeburn.org ([2002:d03b:b25a:1:201:2ff:fe23:e26d]) by raeburn.org (8.11.3/8.11.3) with ESMTP id g6ILjYf05188; Thu, 18 Jul 2002 17:45:34 -0400 (EDT) Original-Received: from raeburn by kal-el.raeburn.org with local (Exim 3.35 #1 (Debian)) id 17VJ5a-0008K7-00; Thu, 18 Jul 2002 17:45:34 -0400 Original-To: Kai.Grossjohann@cs.uni-dortmund.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) In-Reply-To: (Kai.Grossjohann@CS.Uni-Dortmund.DE's message of "Wed, 17 Jul 2002 11:11:56 +0200") Original-Lines: 52 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.1.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5878 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5878 > Is there a way to use Guile (Scheme?) to emulate Emacs Lisp? I think > somebody has written a Common Lisp module that emulates Emacs Lisp, > but I haven't heard about Guile/Scheme. I think as a proof of concept you could write a machine-code and system-call emulator in Scheme, and run the current Emacs binary including its Lisp interpreter, so, yes. Of course, the interesting trick is to do it more efficiently than that. :-) People have definitely worked on it. The Guile CVS repository contains some code that loads quite a bit of elisp. I haven't looked at it in a while, so I can't tell you anything about the performance, but I think it did depend on some extension code written in C; why, I'm not sure, but that costs some karma points in my book. Some XEmacs people (including one who told me he's interested in converting XEmacs to a Scheme base, but not with Guile) are developing techniques for doing static analysis of Lisp code to determine when dynamic bindings can be replaced with static bindings, to enable the generated Scheme code to be more efficient. Their goal is (possibly expensive) conversion of Lisp libraries into Scheme libraries, which could then be loaded at run-time as Scheme, or compiled, whatever. > Or is the idea to have two languages side-by-side in Emacs? I think > this side-by-side feature is a strong point of Guile. But I don't > know much about Guile, so this could be totally wrong. If we don't have full run-time translation, we can still use the existing interpreter, modified to work with the new shared object representation. In fact, that's my first goal, having the modified Lisp interpreter run Emacs, without even having any Scheme code running at all. Then get Scheme going, and at least minimal interaction between the two languages. I think it would be a mistake to stop there. The Guile folks have a decent run-time byte-code generator running, and machine code generation may be a possibility down the road. Converting Emacs Lisp byte codes to C should be pretty easy too, but my impression is that Scheme lends itself better to certain kinds of optimizations. (For example, lexical binding means you can use C local variables instead of setting and restoring bindings of global variables, and the C optimizer can probably do a better job with that.) It'll certainly be worth looking at more closely. Will it be a worthwhile change? That'll depend on a lot of factors. We may find that Guile needs a lot of work to bring its speed up to the level we need. We may find its memory use to be a problem. These and other parts of Guile are being worked on now; it's hard to predict where they'll stand when we're ready to look at this question.