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

Re: Issue: LOAD-OBJECTS (Version 3)

> One is that this scheme cannot support circular constants.

I second the objection.

> By the way, I also share rpg's preference for functions over forms,
> because functions are parametrized naturally via captured lexicals,
> whereas you've got to use backquote to parametrize forms, a more
> error-prone technique.
> Here's an example which suggests the relative conciseness of the techniques:
> 	;; Using functions:
> 	(defmethod make-load-form ((x myclass))
> 	  (let ((p <pval>) (q <qval>) (r <rval>))
> 	    #'(lambda () <code>)))
> 	;; Using forms:
> 	(defmethod make-load-form ((x myclass))
> 	  `(let ((p ',<pval>) (q ',<qval>) (r ',<rval>))
> 	     <code>))

I don't think that's a completely fair comparison because the LET is
required for the function approach, but would usually not be needed with
the forms approach:

	;; Using functions:
	(defmethod make-load-form ((x myclass))
	  (let ((p <pval>) (q <qval>) (r <rval>))
	    #'(lambda () (make-mine p q r))))

	;; Using forms:
	(defmethod make-load-form ((x myclass))
          `(make-mine ',<pval> ',<qval> ',<rval>))

This is a very simple use of back-quote, while the function approach is
error-prone because it would be too easy to forget to do the LET