From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: GOOPS: Customizing class instantiation Date: Tue, 26 Sep 2006 10:24:58 +0200 Organization: LAAS-CNRS Message-ID: <87psdjnig5.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159259151 11631 80.91.229.2 (26 Sep 2006 08:25:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Sep 2006 08:25:51 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 26 10:25:49 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GS8Fj-0008ED-49 for guile-user@m.gmane.org; Tue, 26 Sep 2006 10:25:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GS8Fh-0007P8-Br for guile-user@m.gmane.org; Tue, 26 Sep 2006 04:25:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GS8Fd-0007P2-2O for guile-user@gnu.org; Tue, 26 Sep 2006 04:25:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GS8Fc-0007Oq-H5 for guile-user@gnu.org; Tue, 26 Sep 2006 04:25:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GS8Fc-0007On-4x for guile-user@gnu.org; Tue, 26 Sep 2006 04:25:12 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GS8KC-0007aE-SU for guile-user@gnu.org; Tue, 26 Sep 2006 04:29:57 -0400 Original-Received: by laas.laas.fr (8.13.7/8.13.4) with SMTP id k8Q8P8Ag000557; Tue, 26 Sep 2006 10:25:10 +0200 (CEST) Original-To: Guile-User X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 5 =?iso-8859-1?Q?Vend=E9miaire?= an 215 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Guile-User User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5543 Archived-At: Hi, I'm trying to "dynamically" create classes which I would then like to instantiate. The behavior I would like to achieve is that: guile> (define c (make-a-class 'some-name)) guile> (define obj (make c)) guile> obj #< some-name deadbeef> To that purpose, I have a metaclass named `' and a procedure `make-a-class' that simply returns instances of `'. Since `compute-cpl' is customized for instances of `', I can make sure that instances of `' have a proper CPL that includes `'. Here's the code: (use-modules (oop goops)) (read-set! keywords 'prefix) (define-class () (the-slot :init-value #t)) (define-method (compute-cpl (c )) (format (current-error-port) "CPL (~a)~%" c) (list c )) (define-method (make-instance (c )) (format (current-error-port) "make-instance (~a)~%" c) (next-method)) (define (make-a-class name) (let ((c (make ))) (slot-set! c 'name name) c)) The issue is that when instantiating an instance of `' (read that twice ;-)), I'm getting the following error: ;; Create a class (instance of `'). guile> (define c (make-a-class 'paf)) CPL (#< ??? 301f8930>) guile> c #< paf 301f8930> ;; Instantiate it. guile> (make c) make-instance (#< paf 301f8930>) : In expression (let* (#) (format # "make-instance (~a)~%" ...) ...): : No applicable method for #< initialize (10)> in call (initialize # ()) ABORT: (goops-error) This is quite unexpected since I would expect, at least, the `initialize' class for instances of `' to be applicable. The other surprising thing is that the instance to be initialized is still seen as # instead of # or some such. Any idea? Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user