[Armedbear-ticket] [armedbear] #368: File level define-setf-expander is not available for expansion unless wrapped in an eval-when
armedbear
armedbear-devel at common-lisp.net
Mon Sep 1 08:12:47 UTC 2014
#368: File level define-setf-expander is not available for expansion unless
wrapped in an eval-when
-----------------------+-----------------------
Reporter: mevenson | Owner:
Type: defect | Status: new
Priority: major | Milestone: 1.4.0
Component: java | Version: 1.4.0-dev
Resolution: | Keywords:
-----------------------+-----------------------
Comment (by mevenson):
The exact conditions to trigger this problem are not simple, as the
following works in both interpreted and compiled modes
{{{
;;<file:///opt/local/share/doc/lisp/HyperSpec-7-0/HyperSpec/Body/m_defi_3.htm>
(defun lastguy (x)
(car (last x)))
(define-setf-expander lastguy (x &environment env)
"Set the last element in a list to the given value."
(multiple-value-bind (dummies vals newval setter getter)
(get-setf-expansion x env)
(let ((store (gensym)))
(values dummies
vals
`(,store)
`(progn (rplaca (last ,getter) ,store) ,store)
`(lastguy ,getter)))))
(defun use-lastguy ()
(let ((a `(1 2 3 4)))
(setf (lastguy a) 42)
a))
}}}
--
Ticket URL: <http://abcl.org/trac/ticket/368#comment:2>
armedbear <http://abcl.org>
armedbear
More information about the armedbear-ticket
mailing list