On 9/26/06, Ludovic Courtès wrote: (define-method (make-instance (c )) (format (current-error-port) "make-instance (~a)~%" c) (next-method)) Try adding a '. initargs' after '(c )'. cheers pat On 9/26/06, Ludovic Courtès wrote: > > 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 >