From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Kraft Newsgroups: gmane.lisp.guile.devel Subject: Re: %nil once again Date: Fri, 24 Jul 2009 08:20:15 +0200 Message-ID: <4A69529F.2030606@domob.eu> References: <4A5F2F8A.5040108@domob.eu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248416412 7436 80.91.229.12 (24 Jul 2009 06:20:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jul 2009 06:20:12 +0000 (UTC) Cc: Neil Jerram , guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jul 24 08:20:05 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MUE8S-0000OJ-DO for guile-devel@m.gmane.org; Fri, 24 Jul 2009 08:20:04 +0200 Original-Received: from localhost ([127.0.0.1]:60955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUE8R-0002lt-IY for guile-devel@m.gmane.org; Fri, 24 Jul 2009 02:20:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MUE8K-0002jd-BM for guile-devel@gnu.org; Fri, 24 Jul 2009 02:19:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MUE8F-0002eB-Ld for guile-devel@gnu.org; Fri, 24 Jul 2009 02:19:55 -0400 Original-Received: from [199.232.76.173] (port=53475 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUE8F-0002e4-BC for guile-devel@gnu.org; Fri, 24 Jul 2009 02:19:51 -0400 Original-Received: from taro.utanet.at ([213.90.36.45]:56333) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MUE8E-0001JY-NV for guile-devel@gnu.org; Fri, 24 Jul 2009 02:19:51 -0400 Original-Received: from plenty.xoc.tele2net.at ([213.90.36.8]) by taro.utanet.at with esmtp (Exim 4.69) (envelope-from ) id 1MUE89-0004pg-Sa; Fri, 24 Jul 2009 08:19:45 +0200 Original-Received: from d83-187-186-129.cust.tele2.at ([83.187.186.129] helo=[192.168.1.18]) by plenty.xoc.tele2net.at with esmtpa (Exim 4.69) (envelope-from ) id 1MUE89-0003OL-Nl; Fri, 24 Jul 2009 08:19:45 +0200 User-Agent: Thunderbird 2.0.0.0 (X11/20070425) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8955 Archived-At: Hi Andy, thanks for your comments! Andy Wingo wrote: > Reviewing (and merging as much as possible of) your elisp branch is my > next Guile task, after taking care of that bug recently reported by > Martin Ward. Should be short work at this point. Cool! But just take your time ;) >> At least, is there some way to construct lists terminated by %nil >> using something like the list primitive? > > It would need to be something you implement as part of the emacs > runtime. > > Otoh, (cons* a b c %nil) will do what you want. Hm, that's an interesting option! Another comment on this subject had been to try without converting the list ends and see how often code relys on exactly %nil being the end-of-list anyways, which is what I've been doing so far. But I can give it a try to convert. >> Other things needed would be for instance terminating rest-arguments >> by %nil rather than '() and the like. > > Hmmmmm. This is a good question. I think that, on the bytecode side, you > would have to receive the normal Scheme rest argument, then run through > it and replace the terminating '() with %nil. So when compiling > functions that take rest args, they'd have this operation as one of > their first instructions. There could be a VM op for this if necessary. Yes, at the moment I already have to do some pre-processing of the rest argument at function entry anyways, to handle, for instance, optional arguments. So I can just do the conversion there. A VM op might be interesting, but as you suggested I'll just write a runtime-function and call it; we can do perfomance optimization later on when we really know what the problems are. > On the other other hand... can we enumerate the set of circumstances in > which we'd want to change a Scheme list to an Elisp list? Call, > obviously. Probably we want to support tail recursion in calls within > elisp, so tail calls too. Reading, but the elisp reader has to be > slightly different anyway. If it's only calls, we can do tricks in the > VM to make things faster. I think it would be lists generated by the compiler for certain constructs (but I think all of those are only handed to primitives and never seen by elisp, so they don't matter), of course the rest arguments already mentioned, and most notably return values from primitives that return lists -- those need to be converted between the Guile primitive and elisp, but that should also be only a call to the conversion routine and hopefully not result in too bad performance. So, maybe a next thing for me will be to work on this conversion. Yours, Daniel -- Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz To go: Hea-Kni-Mon-Pri