From martin at lispworks.com Fri Jun 10 15:35:59 2011 From: martin at lispworks.com (Martin Simmons) Date: Fri, 10 Jun 2011 16:35:59 +0100 (BST) Subject: [anaphora-devel] Bug in internal-symbol-macrolet setf expander Message-ID: <201106101535.p5AFZxc5023676@carson.cam.lispworks.com> Hi there, The setf expander for internal-symbol-macrolet makes unwarranted assumptions about the getter form (that it can be used with setf). Ironically, this setf expander itself returns a form that would fail if used like that! I'd like to propose the following definition, which I think is equivalent (it passes the test suite at least): (define-setf-expander internal-symbol-macrolet (binding-forms place &environment env) (multiple-value-bind (dummies vals newvals setter getter) (get-setf-expansion place env) (values dummies (substitute `(symbol-macrolet ,binding-forms it) 'it vals) newvals `(symbol-macrolet ,binding-forms ,setter) `(symbol-macrolet ,binding-forms ,getter)))) -- Martin Simmons LispWorks Ltd http://www.lispworks.com/ From julian at cipht.net Mon Jun 13 06:50:37 2011 From: julian at cipht.net (Julian Squires) Date: Mon, 13 Jun 2011 06:50:37 +0000 Subject: [anaphora-devel] Bug in internal-symbol-macrolet setf expander In-Reply-To: <201106101535.p5AFZxc5023676@carson.cam.lispworks.com> References: <201106101535.p5AFZxc5023676@carson.cam.lispworks.com> Message-ID: Hi, On Fri, Jun 10, 2011 at 3:35 PM, Martin Simmons wrote: > The setf expander for internal-symbol-macrolet makes unwarranted assumptions > about the getter form (that it can be used with setf). ?Ironically, this setf > expander itself returns a form that would fail if used like that! This looks reasonable. Could you supply a test case that breaks the earlier definition? Otherwise it may take me a few days to get to this. Thanks, -- Julian Squires From martin at lispworks.com Mon Jun 13 10:56:57 2011 From: martin at lispworks.com (Martin Simmons) Date: Mon, 13 Jun 2011 11:56:57 +0100 Subject: [anaphora-devel] Bug in internal-symbol-macrolet setf expander In-Reply-To: (message from Julian Squires on Mon, 13 Jun 2011 06:50:37 +0000) References: <201106101535.p5AFZxc5023676@carson.cam.lispworks.com> Message-ID: <201106131056.p5DAuvIq028117@higson.cam.lispworks.com> >>>>> On Mon, 13 Jun 2011 06:50:37 +0000, Julian Squires said: > > Hi, > > On Fri, Jun 10, 2011 at 3:35 PM, Martin Simmons wrote: > > The setf expander for internal-symbol-macrolet makes unwarranted assumptions > > about the getter form (that it can be used with setf). ?Ironically, this setf > > expander itself returns a form that would fail if used like that! > > This looks reasonable. Could you supply a test case that breaks the > earlier definition? Otherwise it may take me a few days to get to > this. Here is a slightly contrived example. (defun elt-like (index seq) (elt seq index)) (define-setf-expander elt-like (index seq) (let ((index-var (gensym "index")) (seq-var (gensym "seq")) (store (gensym "store"))) (values (list index-var seq-var) (list index seq) (list store) `(if (listp ,seq-var) (setf (nth ,index-var ,seq-var) ,store) (setf (aref ,seq-var ,index-var) ,store)) `(if (listp ,seq-var) (nth ,index-var ,seq-var) (aref ,seq-var ,index-var))))) (let ((cell (list nil))) (anaphora:sor (elt-like 0 cell) (setf anaphora:it 1)) (equal cell '(1))) Regards, Martin Simmons LispWorks Technical Support http://www.lispworks.com/support/ From julian at cipht.net Tue Jun 14 13:16:24 2011 From: julian at cipht.net (Julian Squires) Date: Tue, 14 Jun 2011 13:16:24 +0000 Subject: [anaphora-devel] Bug in internal-symbol-macrolet setf expander In-Reply-To: <201106131056.p5DAuvIq028117@higson.cam.lispworks.com> References: <201106101535.p5AFZxc5023676@carson.cam.lispworks.com> <201106131056.p5DAuvIq028117@higson.cam.lispworks.com> Message-ID: Thanks! This has been committed to the CVS repository on common-lisp.net. Please let me know if there are any other issues. -- Julian Squires From julian at cipht.net Wed Jun 15 14:07:49 2011 From: julian at cipht.net (Julian Squires) Date: Wed, 15 Jun 2011 14:07:49 +0000 Subject: [anaphora-devel] Anaphora 0.9.4 released Message-ID: Hi, Since there have been a few minor fixes and additions building up in the CVS repository, I have made a new release of anaphora, available from . Just short of the fifth anniversary of the last release. Please let me know if you discover anything erroneous, or if there are other requests. Cheers, -- Julian Squires