From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.user Subject: [GOOPS] Specializing to allow lazy method addition Date: Fri, 23 Jan 2004 12:38:45 +0100 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <87fze6x5bu.fsf_-_@alice.rotty.yi.org> References: <87smkc5b22.fsf@alice.rotty.yi.org> <874qwhsa2u.fsf@zip.com.au> <1074535797.1517.64.camel@localhost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1074858571 25523 80.91.224.253 (23 Jan 2004 11:49:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Jan 2004 11:49:31 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jan 23 12:49:25 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AjzoS-0004Zg-00 for ; Fri, 23 Jan 2004 12:49:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AjznP-0002Tc-MG for guile-user@m.gmane.org; Fri, 23 Jan 2004 06:48:19 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AjzkV-00025e-Kf for guile-user@gnu.org; Fri, 23 Jan 2004 06:45:19 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Ajzjl-0001xV-S0 for guile-user@gnu.org; Fri, 23 Jan 2004 06:45:05 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.24) id 1AjzeT-0001AI-3X for guile-user@gnu.org; Fri, 23 Jan 2004 06:39:05 -0500 Original-Received: (qmail 6888 invoked by uid 65534); 23 Jan 2004 11:39:01 -0000 Original-Received: from chello212186006140.401.14.univie.teleweb.at (EHLO garibaldi) (212.186.6.140) by mail.gmx.net (mp005) with SMTP; 23 Jan 2004 12:39:01 +0100 X-Authenticated: #3102804 Original-Received: from ivanova.rhinosaur.lan ([192.168.1.9] helo=ivanova) by garibaldi with esmtp (Exim 4.30) id 1AjzeA-0004oo-Dc; Fri, 23 Jan 2004 12:38:46 +0100 Original-Received: from andy by ivanova with local (Exim 4.30) id 1Ajze9-0001Po-44; Fri, 23 Jan 2004 12:38:45 +0100 Original-To: guile-gtk-general@gnu.org, Guile Users In-Reply-To: <1074535797.1517.64.camel@localhost> (Andy Wingo's message of "Mon, 19 Jan 2004 20:09:58 +0200") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) X-Spam-Score: -4.9 (----) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2693 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2693 Andy Wingo writes: > On Thu, 2003-12-04 at 02:25, Kevin Ryde wrote: >> I wonder if some lazy initializing would be possible, like catch a >> failed method dispatch and add only at that time. (But my ignorance >> of goops is pretty profound, so maybe it's not feasible.) > > This is really a direct response to Andreas' question a couple days ago, > which I have read but don't have on my laptop... > > I think I said something like make `add-method' cache methods, only > adding them when `no-method' is called. We can look at the GOOPS manual > (goops.info) to see what I mean. > > `Method Definition Internals' states that after ensuring the generic and > creating the method, that the method is added to the generic via the > generic `add-method!'. If the generics we create are actually subclasses > of , we can specify `add-method!' to just keep the method in a > holding pen of sorts. Which is to say, > > (define-class () > (temp-methods :init-value '())) > (define-method (add-method! (generic ) > (method )) > ;; Note we don't call next-method > (slot-set! generic 'temp-methods > (cons method (slot-ref generic 'temp-methods)))) > I tried to play around with this a bit and it seems it is not viable ATM; I experienced the problem described already in [0] and [1]. It seems noone has answered why %invalidate-method cache insists on a pure generic (from goops.c, in scm_sys_invalidate_method_cache_x): SCM_ASSERT (SCM_PUREGENERICP (gf), gf, SCM_ARG1, FUNC_NAME); and what 'pure' generics are all about; FWICT, pureness is a flag set for all built-in generic classes. Would someone of GOOPS knowledge please be so kind to shed some light on this issue? [0] http://mail.gnu.org/archive/html/guile-user/2002-04/msg00197.html [1] http://mail.gnu.org/archive/html/guile-user/2003-07/msg00061.html Thanks, Andy -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62 Python is executable pseudocode, Perl is executable line-noise. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user