An issue where defsetf doesn't work for a symbol defined by symbol-macrolet

Seki_GMail hamgoostar at gmail.com
Mon Apr 8 15:12:11 UTC 2019


Hi,

Thanks for your great project.

I found an issue where defsetf doesn't work for a symbol defined by
symbol-macrolet.
The detail is the following.

## environment
- version of Parenscript
    - latest of master (526346549f0342d67947d360a8f7ba9fc7b09e54)
- CL Implementation (same result in both)
    - SBCL 1.5.0
    - Clozure CL 1.11.5

## code to reproduce
```lisp
(use-package :parenscript)

(princ
 (ps
   (defun my-car (lst)
     (nth 0 lst))
   (defun my-set-car (lst value)
     (setf (nth 0 lst) value))

   (defsetf my-car (lst) (value)
     `(my-set-car ,lst ,value))

   ;; Raw setf is ok
   (setf (my-car lst) 100)

   ;; setf for macrolet symbol is NG
   (symbol-macrolet ((sym (my-car lst)))
     (setf sym 300))))
```

Then, the result is the following.
(I added some comments for convenience.)

```javascript
function myCar(lst) {
    __PS_MV_REG = [];
    return nth(0, lst);
};
function mySetCar(lst, value) {
    __PS_MV_REG = [];
    return nth(0, lst) = value;
};
/* Raw setf is ok */
(function () {
    var _js66 = lst;
    var _js65 = 100;
    __PS_MV_REG = [];
    return mySetCar(_js66, _js65);
})();
/* setf for macrolet symbol is NG */
myCar(lst) = 300;
```

Thanks.

Regards,
--
Eiji, Seki (hamgoostar at gmail.com)
https://github.com/eshamster
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20190409/0f59beb6/attachment.html>


More information about the parenscript-devel mailing list