[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: LOAD-OBJECTS (Version 3)
- To: jrose@Sun.COM (John Rose)
- Subject: Re: Issue: LOAD-OBJECTS (Version 3)
- From: David N Gray <Gray@DSG.csc.ti.com>
- Date: Mon, 13 Mar 89 19:35:35 CST
- Cc: sandra%defun@cs.utah.edu, rpg@lucid.com, CL-Cleanup@sail.stanford.edu, CL-Compiler@sail.stanford.edu
- In-reply-to: Msg of Mon, 13 Mar 89 11:35:38 PST from jrose@Sun.COM (John Rose)
- Sender: GRAY@Kelvin.csc.ti.com
> 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
binding.