From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: Delegation in goops?
Date: Sat, 11 Feb 2006 11:34:14 +0000 [thread overview]
Message-ID: <87psluku2x.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <43ECD742.8040808@mail.msen.com> (Alan Grover's message of "Fri, 10 Feb 2006 13:11:14 -0500")
Alan Grover <awgrover@mail.msen.com> writes:
> 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.
Sounds like a job for inheritance to me. But I'm sure you must have
thought of that and rejected it already, so can you explain why? That
will probably throw some more light on your objective and thinking.
> 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".
The functioning of next-method is based on inheritance.
> "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.
But if you could customize no-applicable-method to return a just in
time method, you can equally well define your fallback method using
define-method, can't you? (Using <top> to ensure that it matches all
possible arg types.) So I don't think this is a significant
restriction.
Regards,
Neil
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2006-02-11 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-10 18:11 Delegation in goops? Alan Grover
2006-02-11 11:34 ` Neil Jerram [this message]
2006-02-19 15:24 ` Alan Grover
[not found] ` <6efab2350602250249r22295420vbd66286e5a05d12e@mail.gmail.com>
2006-03-03 18:44 ` Alan Grover
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87psluku2x.fsf@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).