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: Andreas Rottmann
Subject: Re: [GOOPS] make class-name a generic?
Date: Tue, 24 Feb 2004 03:11:04 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Mikael Djurfeldt <address@hidden> writes:

> 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:
>>
[snip]
>> 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.
>
I don't want to define any methods on clases on it, just on plain
objects, so I guess it could be made generic, with the warning:
undefined behaviour results if you specialize class-name for
descendents of <class>.

> Also, if we change the status of class-name, there are several other
> class getter functions that we might want to change.
>
I haven't looked at that, but I slightly consider non-generics
namespace pollution: they take away a much greater extent of the
namespace -- a whole name -- as opposed to generics with a few
methods, which take only a part of the name's namespace.

> 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.)
>
It is a "real example", since it is the cut-down version of real code.

> Could you explain why you need to add methods to class-name?
>
Because it's very convinient in my case: I'm working on G-Wrap-TNG (an
OO-rewrite using GOOPS of G-Wrap[0]) and in the G-Wrap environment, I
have "types", which can be attributed with a class name. Note that a
type is an instance in G-Wrap; so it would be very nice to be able to
say (class-name type) to get the class name associated with a type.

[0] http://yi.org/rotty/GWrap

Cheers, Andy
-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Any technology not indistinguishable from magic is insufficiently advanced.
   -- Terry Pratchett




reply via email to

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