Skip to content

Conversation

@enometh
Copy link

@enometh enometh commented Sep 27, 2020

  • lib/setf.lisp: (defsetf) use CCL::%DESTRUCTURE-LAMBDA-LIST instead
    of CCL::RENAME-LAMBDA-VARS to come up with a suitable setf
    expansion.

https://lists.clozure.com/pipermail/openmcl-devel/2020-September/012217.html

Currently CCL does not expand defsetf lambda lists of the form
(defsetf get-foo (&key (add1 1) (add2 (+ add1 2)))
(data)
`(setq $foo (- ,data ,add1 ,add2)))
(get-setf-expansion '(get-foo))
;; => The value #:ADD1 is not of the expected type NUMBER.

WIP. This patch tries to rectify that. With this patch

(setf (get-foo) 10) ;; should return 6

The patch is for review and doesn't fix indentation and involved the
use of of an unhygenic EXPRESSION symbol. This is to facilitate easy
review.

@enometh enometh force-pushed the fix-defsetf-lambda-list branch from 2e08d57 to 4f05bfd Compare October 17, 2020 16:35
Copy link
Author

@enometh enometh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should merge/commit/pull-request not be here. I think I messed up when trying to use the API and there isn't a way to remove it Please delete it if you can.

I did push an update to the fix-defsetf-lambda-list - which should have been sufficient. The update fixes a bug where the declarations were misplaced

@enometh enometh force-pushed the fix-defsetf-lambda-list branch from 9f6c721 to e7552a5 Compare November 28, 2021 02:27
* lib/setf.lisp: (defsetf) use CCL::%DESTRUCTURE-LAMBDA-LIST instead
of CCL::RENAME-LAMBDA-VARS to come up with a suitable setf
expansion.

https://lists.clozure.com/pipermail/openmcl-devel/2020-September/012217.html

Currently CCL does not expand defsetf lambda lists of the form
(defsetf get-foo (&key (add1 1) (add2 (+ add1 2)))
	 (data)
 `(setq $foo (- ,data ,add1 ,add2)))
(get-setf-expansion '(get-foo))
;; => The value #:ADD1 is not of the expected type NUMBER.

WIP. This patch tries to rectify that. With this patch

(setf (get-foo) 10) ;; should return 6

The patch is for review and doesn't fix indentation and involved the
use of of an unhygenic EXPRESSION symbol. This is to facilitate easy
review.
@enometh enometh force-pushed the fix-defsetf-lambda-list branch from e7552a5 to d3a908b Compare June 10, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant