Re: CLOS question



Barry Margolin <barmar@xxxxxxxxxxxx> writes:

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.

That's a reasonable point of view, certainly. Though often the
problem is with some particular method and that can mean giving up an
awful lot of other stuff you don't want to give up.

I've personally found this inability to refine or enhance an inherited
:after or :before method a pain, and I wanted to just say so lest
someone think they were irrational for being annoyed. It's sometimes
indeed a pain ... even though it's also equally possible for someone
writing a method to take some comfort in your lack of easy ability to
overcome their method. It's a kind of "unstoppable force meets
impenetrable barrier" problem, with arguments on both sides.

It seems to me, though I haven't tried, that it would be possible to
write a method combination that worked differently, perhaps allowing a
:shadowed-after qualifier that, if used, would cause the inherited
:after methods to appear only under a call-next-method. Or perhaps
a complementary tactic: just using :after but providing a way to do
(skip-next-method) or (skip-next-methods n) or something like that.

Maybe skipping :before or :after methods will accidentally fail to do
important stuff, but then, so does failing to call call-next-method if
all the computation is being done in the primary, and people mostly
work that out... each paradigm trades off the issues of functionality,
safety, convenience, modularity, etc. in different ways.

I see no reason for someone not to try something like that out, and
advertise it for others to use if they find they get something that
feels good. The language is full of opportunities to experiment with
things like this.
.



Relevant Pages

  • Re: Code generation
    ... Nick Hodges (CodeGear) wrote: ... parent class -- if that is the way your component peristence worked. ... It will give the "B' does not inherit A'" sydrome. ... You must know about the runtime subtyping, ...
    (borland.public.delphi.non-technical)
  • Re: Class Inheritance
    ... One suggestion was to have a parent class that ... Class A and Class B both inherit from and have the property in question be ... properties of the parent class? ... Btw, I'm coding in C#, in ...
    (microsoft.public.dotnet.general)
  • Handling a network reply - best method?
    ... connect dependant on the sent request from the client. ... I want all the network code i have done to be in one class and then i want ... to inherit that class for a new class which i will put all my application ... function when the parent class gets a datareceive? ...
    (microsoft.public.win32.programmer.networks)
  • Re: Modules in rails? ( controllers or models?)
    ... So I am thinking to create a parent class and then the sub ... But rails already inherits from ActiveRecord ... So how can I inherit from others classes. ...
    (comp.lang.ruby)