[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue: SETF-METHOD-FOR-SYMBOLS (version 1)



Well, here's our setf method for Getf.  It clearly is not using some
private method to get symbols right, but is using the standard setf
method for whatever the first form is.  It seems to me that the way it
is using the store variable from the first subform is fairly
straightforward, and doesn't introduce more temporaries than would be
needed under your scheme, but I could be wrong.

Can you show me the Getf method that would result from your proposed way
of handling the symbol values?  Is it significantly simpler or more
efficient?  When it comes to efficiency, I'd rather have a little extra
variable shuffling in Getf and places like that than in all setf's
involving a symbol destination.

(define-setf-method getf (place prop &optional default &environment env)
  (multiple-value-bind (temps values stores set get)
		       (get-setf-method place env)
    (let ((newval (gensym))
	  (ptemp (gensym))
	  (def-temp (gensym)))
      (values `(,@temps ,(car stores) ,ptemp ,@(if default `(,def-temp)))
	      `(,@values ,get ,prop ,@(if default `(,default)))
	      `(,newval)
	      `(progn (setq ,(car stores)
			    (%primitive putf ,(car stores) ,ptemp ,newval))
		      ,set
		      ,newval)
	      `(getf ,(car stores) ,ptemp ,@(if default `(,def-temp)))))))

-- Scott