jscl-project / jscl

A Lisp-to-JavaScript compiler bootstrapped from Common Lisp

Home Page:https://jscl-project.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(SETF GETF) is buggy

Gleefre opened this issue · comments

(let ((x (list :a 10 :b 20)))
  (setf (getf x :b) 0)
  x)
; => (:B 0)
;; should be: (:A 10 :B 0)

It seems to be caused by this line:
https://github.com/jscl-project/jscl/blob/master/src/list.lisp#L482C1-L482C1

If I understand it correctly, it should be (return plist) instead.

To be honest, the spec doesn't specify what setf of getf should return. The example shows it returning the value it set.

The problem is not in the return value of (SETF GETF) but in the side effect of discarding the property :A

Ah, sorry, overlooked that you returned the plist. Very well, proceed ^^.