From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: Re: goops and memoization Date: Thu, 21 Nov 2002 20:08:01 -0500 Sender: guile-devel-admin@gnu.org Message-ID: References: Reply-To: djurfeldt@nada.kth.se NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1037927368 24303 80.91.224.249 (22 Nov 2002 01:09:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 22 Nov 2002 01:09:28 +0000 (UTC) Cc: djurfeldt@nada.kth.se, Dirk Herrmann , 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 18F2Ju-0006J5-00 for ; Fri, 22 Nov 2002 02:09:22 +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 18F2Je-0002vc-00; Thu, 21 Nov 2002 20:09:06 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18F2Ii-0001Tu-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 20:08:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18F2Ig-0001RQ-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 20:08:07 -0500 Original-Received: from kvast.blakulla.net ([213.212.20.77]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18F2If-0001RL-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 20:08:05 -0500 Original-Received: from linnaeus ([18.42.2.46]) by kvast.blakulla.net with esmtp (Exim 3.36 #1 (Debian)) id 18F2Ib-0004F9-00; Fri, 22 Nov 2002 02:08:02 +0100 Original-Received: from mdj by linnaeus with local (Exim 3.36 #1 (Debian)) id 18F2Ib-0008WR-00; Thu, 21 Nov 2002 20:08:01 -0500 Original-To: Neil Jerram Original-Cc: djurfeldt@nada.kth.se In-Reply-To: (Neil Jerram's message of "21 Nov 2002 23:50:20 +0000") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) 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:1740 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1740 Neil Jerram writes: >>>>>> "Mikael" == Mikael Djurfeldt writes: > > Mikael> (An alternative solution is to implement compile-method in > Mikael> C, memoizing the source code while walking through it. In > Mikael> fact, that could mean that we don't need to call > Mikael> procedure-source => no need to unmemoize code.) > > A further possibility occurs to me - transforming the method > definition at define-method time something like this: > > (define-macro (make-method gf specializers formals . body) > `(letrec ((m (lambda ,formals > (define (next-method) > (call-next-method ,gf > ,specializers > m > ,@formals)) > ,@body))) > m)) > > Given the gf and specializers, call-next-method works out a list of > applicable methods (probably cached) in the same way as for a normal > gf application, then it looks through this list for m and applies the > method after m to the supplied arguments (formals). > > Would this kind of approach work? It would "work", but gee... then you are talking about a totally different speed regime than what holds now. Are you saying that you'd want to compute the list of applicable methods at every call to (next-method)? That way overhead per call would become O(NM) where N is the number of applicable methods and M the maximum length of argument lists. Well, then I'd start avoiding to use next-method in certain code, and I'd really hate that. Call me a speed maniac, but I want to be able to write my programs in a form that is similar to how I think of the problem without worrying that it would be too slow. Basic language mechanisms *must* be efficient. You may say (well, *you*, Neil, wouldn't) that "well, then you shouldn't use scheme", but my point is that I'd like to use these nice ways of expressing programs in as great extent as possible. [For those who still think I'm being silly: My programs currently run for *days* just analyzing one data set...] Mikael _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel