[lisp-interface-library-devel] <invertible>

Dan Lentz danlentz at gmail.com
Thu Nov 1 02:47:23 UTC 2012


Further thoughts <invertible> question.  Firstly, am I thinking about
that incorrectly?  I guess what I might have been groping for is a
first class base <operation> interface and then something like:


(define-interface <operation> (<interface>) ()
  (:generic> do ())
  (:abstract))

define-interface <invertible> (<operation>) ()
  (:generic> undo ())
  (:abstract))

(define-interface <insert> (<operation> <invertible>)
  ((place :initarg :place :accessor place)
   (thing :initarg :thing :accessor thing))
  (:parametric (&key place thing)
      (make-interface <insert> :place place :thing thing))
  (:method do ((<i> <insert>))
      (insert (place <i>) (thing <i>)))
  (:method undo ((<i> <insert>))
      (drop (place <i>) (thing <i>)))
  (:singleton))

Which would be a first class thing, and can be abstracted over,
whereas the generic function insert as it stands is static and
defining its inverse with just using dispatching of general functions
does not seem equivalent.  Is there a better way to do this?



On Wed, Oct 31, 2012 at 9:15 AM, Dan Lentz <danlentz at gmail.com> wrote:

> Ok I've been rereading the LIL manifesto and its a lot clearer to me
> this time around thanks to our discussion and the exercise of thinking
> about a specific task, such as the rb/wb trees.   (probably the
> repetition can't be hurting either :-)  So I'm jotting down a list of
> general questions/thoughts etc that are not necessarily apropos of
> anything we've been discussing and in no particular order.  I'll try
> not to get too annoying with these, but here is one to start off:
>
> One thought that popped up* was, "Gee, wouldn't <invertible> make a
> good interface?"  Ie the inverse of insert is drop;  The inverse of
> divide is join.  If we defined <invertible> with generics DO and UNDO
> then we could do things like rollback a series of operations.  But
> then I realized that insert/drop/divide/join etc are all functions not
> interfaces.  So if not as an interface what would be the appropriate
> means of doing this?
>
> Generic functions could do it of course but then <invertible> would
> not be a first class thing at least not in the sense of the other IPS
> facilities.
>
>
> * actually the rollback idea should be duly credited as result of
> reading through billitch's transaction code in fact-database




More information about the lisp-interface-library-devel mailing list