guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GOOPS] make class-name a generic?


From: Mikael Djurfeldt
Subject: Re: [GOOPS] make class-name a generic?
Date: Mon, 23 Feb 2004 15:25:36 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Andreas Rottmann <address@hidden> writes:

> In my code, I define a method on class-name. Since (oop goops) defines
> this as a simple procedure, I have to export the generic in my module,
> which leads to annyoing warnings about duplicate imports which are
> superfluous because the original class-name is still "there", just as
> a generic default method. Sample code:
>
> (define-module (foo)
>   #:use-module (oop goops)
>   #:export (<foo> class-name))
>
> (define-class <foo> ()
>   (class-name #:getter class-name #:init-value 'foobar))
>
> (define-module (bar)
>   #:use-module (oop goops)
>   #:use-module (foo))
>
> (format #t "class-name of <foo> instance: ~S\n"
>         (class-name (make <foo>)))
> (format #t "class-name of <foo>: ~S\n" (class-name <foo>))
>
> To do away with this warning, I'd have to specify "#:duplicates last"
> for *every* module using (foo), because (foo) doesn't make much sense
> without (oop goops)).
>
> So, in short: can't class-name be a generic in the first place?

Well, I suppose it could, even though it is a bit delicate to make the
change since class-name is used in the MOP for class redefinition.

Also, if we change the status of class-name, there are several other
class getter functions that we might want to change.

But first I'd like to better understand your needs.  The code above is
not a real example since instances of <foo> aren't classes.
(class-name wants a class as argument.)

Could you explain why you need to add methods to class-name?

Best regards,
Mikael D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]