From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: tomas@fabula.de Newsgroups: gmane.lisp.guile.devel Subject: Memoization, define and all that Date: Sat, 9 Nov 2002 10:29:29 +0100 Sender: guile-devel-admin@gnu.org Message-ID: <20021109092928.GA22591@www> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1036834656 22965 80.91.224.249 (9 Nov 2002 09:37:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 9 Nov 2002 09:37:36 +0000 (UTC) Cc: guile-devel@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18AS3Z-0005y0-00 for ; Sat, 09 Nov 2002 10:37:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18AS2H-00077r-00; Sat, 09 Nov 2002 04:36:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18ARnM-0007cf-00 for guile-devel@gnu.org; Sat, 09 Nov 2002 04:20:48 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18ARmm-0006nd-00 for guile-devel@gnu.org; Sat, 09 Nov 2002 04:20:44 -0500 Original-Received: from [217.22.192.104] (helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.10) id 18ARml-0006lW-00 for guile-devel@gnu.org; Sat, 09 Nov 2002 04:20:11 -0500 Original-Received: by www.elogos.de (Postfix, from userid 5002) id 26E5314DC8; Sat, 9 Nov 2002 10:29:29 +0100 (CET) Original-To: Dirk Herrmann Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1672 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1672 On Sat, Nov 09, 2002 at 09:29:40AM +0100, Dirk Herrmann wrote: > > Clinton Ebadi wrote: > > > I don't care how memoization works. [...] [...] > First, why wouldn't guile be scheme any more if conditional definitions > are disallowed? They are disallowed by R5RS, so actually, if you > understand "being scheme" as "conforming to R5RS" then currently guile is > not scheme and disallowing conditional definitions will bring it one step > closer to "being scheme" :-) Hrm. As marius pointed out elsewhere, this isn't just an issue with define, but actually with any form which might get expanded before/at compile time. > Second, certainly can code be memoized and compiled incrementally. > However, this would have to be done every time the code was read in again, > since in an expression like (if (define of may change every time the code is read in. Yes, as far as we can't make sure (e.g. by static code analysis) that we have a fixed value for . As soon as is known, things look better (and if isn't known, there might be a reason to it, that is, the programmer is willing to pay for the overhead). Of course I'm not favouring a thorough code analysis (is that decidable at all?), but: if you *know* a thing to be constant -- go ahead and memoize, if you *don't know* well, take with you a reference to the lexical environment (you have to do this for macros, in some way or other, don't you?) and leave things as they are. With time you can get better by expanding the set of situations you *know* about. This is what I had in mind when I was talking something about partial evaluation. Does this sound plausible? > That is, we would reduce our possibility to pre-compile code. But only in those cases which you are about to prohibit. You can always pre-compile the ``goodies'' (e.g. those lexical spans where `define is not redefined, etc.). May be I'm overlooking something here, but I tend to view pre-compilation as a kind of constant folding. > Pre compiling code, however, is one of our options to speed up guile's > starting time (aside from optimizing guile's module system...). Yep. And I think it a bearable burden for the programmer to keep some things in mind if she intends to write well-compilable code. But as long as we have eval around (and we won't like to miss this one do we?), we'll have an instance of the compiler/interpreter around, so it doesn't hurt postponing things (other than performance, that is). So the trick might be to just postpone things ``when we don't know better'', because someone is playing nasty tricks with our basic forms (whatever they may be, I think define is just an example). Thanks for your patience in reading my half-baked mumbling. Regards -- tomas _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel