guile-devel
[Top][All Lists]
Advanced

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

GOOPs, MOP and slots


From: David Spångberg
Subject: GOOPs, MOP and slots
Date: Fri, 11 May 2012 14:19:20 +0200 (CEST)
User-agent: SquirrelMail/1.4.15

Hi!

In the CLOS-like language Closette presented in AMOP (The Art of the
Metaobject Protocol) there is a generic method named
`slot-value-using-class' which is used to access the slots of specific
instances. For example this method is used by `slot-value' (`slot-ref'
in GOOPs). In AMOP this generic method is used to implement classes
where every access and modification of slots is logged. It is also used
to implement a class with a kind of dynamic allocation of slots.

In GOOPs however the corresponding function `slot-ref-using-class' is
not generic. My question is if someone know why this is the case? Or
maybe someone can point me to some documentation which may contain
information about this?

My usecase if anyone wanted to know is to implement python-like
attributes as slots for instances. I.e. slots which is not class
specific but instead is only related to the current instance. These
slots should be accessible by using the standard `slot-ref' and
`slot-set! functions in GOOPs.

My guess is that by making `slot-ref-using-class' generic makes it
impossible to memoize slot locations for these kinds of classes. However
this doesn't seem to be reason enough not to make it a generic method
and I wouldn't be suprised if there is some other reason which I don't
understand yet.


Thanks,
David




reply via email to

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