guile-user
[Top][All Lists]
Advanced

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

Delegation in goops?


From: Alan Grover
Subject: Delegation in goops?
Date: Fri, 10 Feb 2006 13:11:14 -0500
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)

Does anybody have a solution to implement delegation in goops?

I have an object that implements the full behavior of interest. Say it's
an employee object.

For whatever perverse reason, which I assure you is reasonable, I want
to wrap the employee in another object. And, for the most part, it will
act just like the employee, except in a few places. Let's say I want to
have the employee masquerade as the CEO. The wrapper would implement a
few methods like "title", "salary", etc. And, specifically, the wrapper
doesn't need to know what all the other methods are, or what might be
added later.

Seems like a job for delegation.

So, I looked at the goops MOP.

"compute-applicable-methods" would let me decide when to delegate or
not. But, "next-method" is implemented in such a way that it doesn't
call "compute-applicable-methods". Though not perfectly clear to me why,
next-method returned "no-method".

"no-applicable-method" assumes that you will throw an exception. It does
not let you substitute a method of your choosing. Specifically, it's
result is discarded, and it appears to be approximately in the same
place as "compute-applicable-methods" so you would get the same problems
as above.







reply via email to

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