Re: Class hierarchy XM_CALLBACKS_FILTER
"Franck Arnaud" <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Stephanie Balzer:
> I wonder why the class XM_CALLBACKS_FILTER inherits from
> XM_CALLBACKS_SOURCE, XM_CALLBACKS and XM_FORWARD_CALLBACKS. Since
> XM_FORWARD_CALLBACKS already inherits from XM_CALLBACKS_SOURCE and
> XM_CALLBACKS, I'd think it were enough that XM_CALLBACKS_FILTER only
> inherits from XM_FORWARD_CALLBACKS.
> What were the reasons for that class hierarchy?
The comment gives a hint:
XM_FORWARD_CALLBACKS
-- implementation of default behaviour:
-- forwarding to 'next' processor in chain
this is to indicate that XM_CALLBACKS_FILTER is an implementation
of XM_CALLBACKS and XM_CALLBACKS_SOURCE abstract interfaces,
which incidentally use XM_FORWARD_CALLBACKS as a default
implementation. It is possible to remove the
XM_FORWARD_CALLBACKS inheritance, and for example implement
the default behaviour directly, without breaking client
code. In other words, it says to clients:
a_callbacks := a_callbacks_filter -- OK
a_forward_callbacks := a_callbacks_filter
-- not OK, not guaranteed to remain valid.
Arguably it's a bit pedantic and could be written in
comments or documentation instead.
This kind of pattern is also seen, perhaps more usefully,
in cases like:
class BLAH
inherit
ANY -- BLAH is a ANY
FOOBAR_ROUTINES -- BLAH uses some routines of FOOBAR_ROUTINES
export {NONE} all end
With some compilers it's necessary as the export {NONE} all
also exports features of ANY to NONE -- which may be the right
thing to do I think -- making say a_blah.is_equal illegal,
if the explicit ANY is absent.
--
http://www.nenie.org/
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/gobo-eiffel/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/