Subject: Re: Is this an abuse of CLOS?
From: Erik Naggum <>
Date: Mon, 29 Apr 2002 00:04:58 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Peter Seibel <>
| Right. But I could always add new methods even if things did change, just
| the same as I could change the mapping vector, right? Or is that a bad
| idea in practice?

  I think adding a new method on read-cp-info is better.  Using a vector of
  class names spreads the information to more places that need concurrent
  updates, which I think asks for trouble in the maintenance phase.

| P.S.  On second thought, I will ask that other question: suppose I have a
| generic function like read-from that takes an object as an argument and I
| want to have all methods on that function return that object.  What's the
| recommended way to achieve that?  Should I define a main method that just
| returns the argument and then do all my specialization in :before
| methods?  Or is this just the wrong way of looking at the problem?

  I think that is a clever way of forcing a protocol, but I am not such a
  fan of forcing protocols that I think you should actually do this,
  because if anyone should write a different main method out of ignorance
  of the protocol, you are probably worse off then if you simply document
  the protocol to return the value.  You would probably have to document
  the protocol to use before methods, too.  This is a tradeoff that you
  have to make based on many additional premises, however.

  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: