🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by john Thu, 12 Nov 1992 17:21
Re: SETF methods
#297
Author: john
Date: Thu, 12 Nov 1992 17:21
41 lines
2502 bytes
Hallvard Tr{tteberg (haltraet%monsun.si.no@uunet.uu.net) writes:

  ... the set of methods of a class should preserve a set of
  invariants related to the class. I.e. the object state before and
  after a (official or exported) method is run should satisfy a set of
  constraints, which of course could be violated while running the
  method.
  With CLOS the methods don't belong to a class but I think the view
  could be adopted, especially in the non-multi method case.

I agree that this is a useful way to look at things.  Some languages,
notably Eiffel, give you ways to make this explicit.  The addition of
such mechanisms to Dylan is also being discussed.  It's nice to be
able to turn the constraint-checking machinery off, especially
selectively.  I don't know if your framework would easily support that
sort of thing.

  My question is whether it's best to generate setf-around-methods to
  take care of such a constraint, or should I make another layer of
  methods, e.g. SET-NODE-OUT-EDGES and SET-EDGE-FROM-NODE ...
  A problem I see, is that the user of the setf-method perhaps expects
  the implementation to have low computational complexity ...

I think SETF methods are perfectly appropriate for this.  The user of
a generic function should have no expectations about its
implementation, unless you state some.  Even if all of the methods are
slot-accessors, there still may be many more than one of them.  I
often write SETF generic functions in which NO methods correspond to
slot-access.  I also use :AROUND, etc., methods on SETFs in which the
primary methods are slot-accessors, often to do exactly the sort of
thing you discuss.

I feel very strongly that one of the strengths of CLOS is that slot
accessors are just methods (a Lisp implementation's special treatment
of them notwithstanding).  Any user who makes such assumptions about
them just doesn't get it.  Anyway, such a user would probably make the
same assumptions about functions named SET-NODE-OUT-EDGES and
SET-EDGE-FROM-NODE.

John Burger
john@mitre.org
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads