I had previously asked about delegation in goops, and had proposed an
ugly solution.

I think I see another solution, since the effect I think I'm looking for
is effectively subclassing but using an already allocated object. 1) If
I create a subclass of the delegatee, I get the proper GF dispatch.
Thus, by default, all GF's are "delegated" unless I override. 2) If I
share the allocated object, than the state is affected as expected.

Subclassing is easy, even "dynamically," since I can get the class of an
object, and modify the delegator's super-classes.

It appears that I can customize the getter/setter methods at class
creation time, so I could construct "delegate" functions for the
knowable list (and presumably, re-construct if the delegatee class
changes). If I didn't want any slots in my delagator, I think I could
almost re-use the delegatee as the allocated data. Otherwise, I just
have to construct the getter/setters that refer to the delegatee.

The 'compute-get-n-set is defined on <class>, so I'd probably have to
make my own <delegator-class>, which makes sense.


_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to