From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: Re: Class methods in GOOPS Date: Sun, 12 Oct 2003 14:16:26 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87he2e4pnp.fsf@alice.rotty.yi.org> References: <20031009161749.GG25684@lark> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1065961019 25366 80.91.224.253 (12 Oct 2003 12:16:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Oct 2003 12:16:59 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Oct 12 14:16:58 2003 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 1A8f9d-0005Q2-00 for ; Sun, 12 Oct 2003 14:16:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A8f8N-0003wk-9t for guile-devel@m.gmane.org; Sun, 12 Oct 2003 08:15:39 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1A8f7Y-0003tO-1k for guile-devel@gnu.org; Sun, 12 Oct 2003 08:14:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1A8f6x-00031j-SV for guile-devel@gnu.org; Sun, 12 Oct 2003 08:14:43 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.24) id 1A8f6o-0002dO-Db for guile-devel@gnu.org; Sun, 12 Oct 2003 08:14:02 -0400 Original-Received: (qmail 5995 invoked by uid 65534); 12 Oct 2003 12:14:00 -0000 Original-Received: from chello213047125140.14.univie.teleweb.at (EHLO garibaldi) (213.47.125.140) by mail.gmx.net (mp003) with SMTP; 12 Oct 2003 14:14:00 +0200 X-Authenticated: #3102804 Original-Received: from ivanova.rhinosaur.lan ([192.168.1.9] helo=ivanova) by garibaldi with esmtp (Exim 4.22) id 1A8f8x-0000k6-V8 for guile-devel@gnu.org; Sun, 12 Oct 2003 14:16:15 +0200 Original-Received: from andy by ivanova with local (Exim 3.36 #1 (Debian)) id 1A8f98-0000tl-00 for ; Sun, 12 Oct 2003 14:16:26 +0200 Original-To: guile-devel@gnu.org In-Reply-To: <20031009161749.GG25684@lark> (Andy Wingo's message of "Thu, 9 Oct 2003 18:17:49 +0200") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2867 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2867 Andy Wingo writes: > Hello, > > It seems there are no class methods in GOOPS. Is this a deliberate > omission, or were they just overlooked? If this is old hat, please point > me to a URL somewhere, I couldn't find any. > What I did to work around this was to make the classes that should have "class methods" (static methods in C++) have a metaclass, then you can specialize methods on the metaclass; e.g: (use-modules (oop goops)) (define-class ()) (define-class ()) (define-class () #:metaclass ) (define-class () #:metaclass ) (define-method (class-method (class ) (msg )) (format #t "I am a static method of class A: ~S\n" msg)) (define-method (class-method (class ) (msg )) (format #t "I am a static method of class B: ~S\n" msg)) (class-method "Hello world") (class-method "Hello world") > Thanks for any insight, > HTH, Andy. Regards, Andy --=20 Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.= at http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B= 62 Latein ist das humanoide =C3=84quivalent zu Fortran. -- Alexander Bartolich in at.linux _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel