Re: CLOS question



In article <joswig-453135.00094030072007@xxxxxxxxxxxxxxxxxxxxxxxx>,
Rainer Joswig <joswig@xxxxxxxxxxxxxx> wrote:

In article <1185746464.124847.288820@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Scott Burson <FSet.SLB@xxxxxxxxx> wrote:

On Jul 29, 2:27 pm, stam...@xxxxxxxx (Rob St. Amant) wrote:
I have what seems like a familiar CLOS question, but a quick Google
search doesn't turn up an answer: I have a method, m, and an after
method for it. The after method is specialized on class c. I'd like
to define a class d that inherits c, and have instances of d behave
just like instances of c *except* for that single after method.

This suggests to me that you have analyzed your domain incorrectly.
It would seem that D is not really a subclass of C if you don't want
it to inherit the full behavior of M.

Why that? Each more specific primary method blocks the
less specific primary method. Thus you are not inheriting
the whole functionality. Sure, you can call the next method,
but by default this is not done. Overwriting less specific
functionality is a capability provided for primary
methods. Just not for :before and :after methods. But those
were design decisions for the standard method combination.

IMHO, :BEFORE and :AFTER methods were created primarily to support the
mixin style of OO programming. If you don't want to inherit these
methods, you simply don't mix the parent class into your class.

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.



Relevant Pages

  • Re: Include module and class inheritance? which one to choose?
    ... but we can achieve the same thing by inherit a class which will get ... You need to approach this issue in terms of semantics rather than ... functionality which is not dependent on a specific object, ... A Math object wouldn't make much ...
    (comp.lang.ruby)
  • Re: subclass with static constructor
    ... it seems to me that you have an inheritance relationship between the functionality. ... But you can only inherit with instances. ... It seems to me that the closest next alternative would be to replicate the entire general-purpose API found in the base class, as static members in the database-specific classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Add custom method to File Class
    ...     Instead of inheriting, you could encapsulate the class inside your own. ... you could use the FileInfo class instead of the File ... FileInfo provides just about the same functionality but uses instance ... You can still not inherit from it because ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CLOS question
    ... to define a class d that inherits c, and have instances of d behave ... It would seem that D is not really a subclass of C if you don't want ... Each more specific primary method blocks the ... functionality is a capability provided for primary ...
    (comp.lang.lisp)
  • How to Adding Functionality to a Class by metaclass(not by inherit)
    ... How to Adding Functionality to a Class by metaclass(not by inherit) ... #Bar want to achieve Foo's part/all functionality, ... unbound method fmust be called with Foo instance as first argument ...
    (comp.lang.python)