User Tools


Function GET-SETF-EXPANSION

Syntax

  • get-setf-expansion place &optional environmentvars, vals, store-vars, writer-form, reader-form

Arguments and Values

Description

Determines five values constituting the setf expansion for place in environment; see section {\secref\SetfExpansions}.

If environment is not supplied or nil, the environment is the null lexical environment.

Examples

(get-setf-expansion 'x)

NIL NIL (#:G0001) (SETQ X #:G0001) X

;;; TODO fix the below example, it seems very broken - ;;; complains about the NEW variable etc.

(defmacro xpop (place &environment env) ; This macro is like POP (multiple-value-bind (dummies vals new setter getter) (get-setf-expansion place env) `(let* (,@(mapcar #'list dummies vals) (,(car new) ,getter)) (when (cdr new) (error "Can't expand this.")) (prog1 (car ,(car new)) (setf ,(car new) (cdr ,(car new))) ,setter))))

(defsetf frob (x) (value) `(setf (car ,x) ,value)) → FROB ;;; The following is an error; an error might be signaled at macro expansion time (flet ((frob (x) (cdr x))) ;Invalid (xpop (frob z)))

Affected By

None.

Exceptional Situations

None.

See Also

Notes

Any compound form is a valid place, since any compound form whose operator f has no setf expander are expanded into a call to (setf f).

\issue{GET-SETF-METHOD-ENVIRONMENT:ADD-ARG} \issue{SETF-METHOD-VS-SETF-METHOD:RENAME-OLD-TERMS} \issue{GET-SETF-METHOD-ENVIRONMENT:ADD-ARG} \issue{GET-SETF-METHOD-ENVIRONMENT:ADD-ARG} \issue{GET-SETF-METHOD-ENVIRONMENT:ADD-ARG}