<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi, <div><br></div><div>For reference:</div><div>The following patch can solve the issue and destroys no existing tests (parenscript.tests:run-tests).</div><div>However, I'm afraid that it is ad-hoc...</div><div><br></div><div>```diff</div><div><div>diff --git a/src/macros.lisp b/src/macros.lisp</div><div>index 986c283..ad0eb00 100644</div><div>--- a/src/macros.lisp</div><div>+++ b/src/macros.lisp</div><div>@@ -334,9 +334,15 @@ lambda-list::=</div><div> (assert (evenp (length args)) ()</div><div> "~s does not have an even number of arguments." `(setf ,args))</div><div> `(progn ,@(loop for (place value) on args by #'cddr collect</div><div>- (aif (and (listp place) (gethash (car place) *setf-expanders*))</div><div>- (funcall it (cdr place) value)</div><div>- `(ps-assign ,place ,value)))))</div><div>+ (progn</div><div>+ (when (atom place)</div><div>+ (setf place (ps-compile place))</div><div>+ (when (and (listp place)</div><div>+ (eq (car place) 'ps-js:funcall))</div><div>+ (setf place (cdr place))))</div><div>+ (aif (and (listp place) (gethash (car place) *setf-expanders*))</div><div>+ (funcall it (cdr place) value)</div><div>+ `(ps-assign ,place ,value))))))</div><div><br></div><div> (defpsmacro psetf (&rest args)</div><div> (let ((places (loop for x in args by #'cddr collect x))</div></div><div>```</div><div><br></div><div><div style="color:rgb(0,0,0)">Regards,</div><div style="color:rgb(0,0,0)">--</div><div style="color:rgb(0,0,0)">Eiji, Seki (<a href="mailto:hamgoostar@gmail.com" target="_blank">hamgoostar@gmail.com</a>)</div><div style="color:rgb(0,0,0)"><a href="https://github.com/eshamster" target="_blank">https://github.com/eshamster</a></div></div><div style="color:rgb(0,0,0)"><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2019年4月9日(火) 0:12 Seki_GMail <<a href="mailto:hamgoostar@gmail.com">hamgoostar@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,</div><div dir="ltr"><br></div><div>Thanks for your great project.</div><div><br></div><div>I found an issue where defsetf doesn't work for a symbol defined by symbol-macrolet.</div><div>The detail is the following.</div><div><br></div><div>## environment</div><div>- version of Parenscript</div><div> - latest of master (526346549f0342d67947d360a8f7ba9fc7b09e54)</div><div>- CL Implementation (same result in both)</div> - SBCL 1.5.0<div> - Clozure CL 1.11.5</div><div><br></div><div>## code to reproduce</div><div>```lisp</div><div dir="ltr"><div>(use-package :parenscript)</div><div dir="ltr"><br></div><div dir="ltr">(princ</div><div dir="ltr"> (ps</div><div dir="ltr"> (defun my-car (lst)</div><div dir="ltr"> (nth 0 lst))</div><div dir="ltr"> (defun my-set-car (lst value)</div><div dir="ltr"> (setf (nth 0 lst) value))</div><div dir="ltr"><br></div><div dir="ltr"> (defsetf my-car (lst) (value)</div><div dir="ltr"> `(my-set-car ,lst ,value))</div><div dir="ltr"><br></div><div dir="ltr"> ;; Raw setf is ok</div><div dir="ltr"> (setf (my-car lst) 100)</div><div dir="ltr"><br></div><div dir="ltr"> ;; setf for macrolet symbol is NG</div><div dir="ltr"> (symbol-macrolet ((sym (my-car lst)))</div><div dir="ltr"> (setf sym 300))))</div><div dir="ltr">```</div><div dir="ltr"><br></div><div>Then, the result is the following.</div><div>(I added some comments for convenience.)</div><div><br></div><div>```javascript</div><div><div>function myCar(lst) {</div><div> __PS_MV_REG = [];</div><div> return nth(0, lst);</div><div>};</div><div>function mySetCar(lst, value) {</div><div> __PS_MV_REG = [];</div><div> return nth(0, lst) = value;</div><div>};</div><div>/* Raw setf is ok */</div><div>(function () {</div><div> var _js66 = lst;</div><div> var _js65 = 100;</div><div> __PS_MV_REG = [];</div><div> return mySetCar(_js66, _js65);</div><div>})();</div><div>/* setf for macrolet symbol is NG */</div><div>myCar(lst) = 300;</div></div></div><div dir="ltr">```</div><div dir="ltr"><br></div><div dir="ltr">Thanks.<br><div><br></div><div>Regards,</div><div>--</div><div>Eiji, Seki (<a href="mailto:hamgoostar@gmail.com" target="_blank">hamgoostar@gmail.com</a>)</div><div><a href="https://github.com/eshamster" target="_blank">https://github.com/eshamster</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>