[Openmcl-devel] another make-record question

Gary Byers gb at clozure.com
Fri Aug 20 03:50:00 PDT 2004

On Fri, 20 Aug 2004, Cyrus Harmon wrote:

> This is probably a lisp FAQ rather than a question specific to
> make-record, but how can I call make-record with the type specified in
> a variable, e.g.:
> CL-USER> (setf moose :v<I>mage_<B>uffer)
> CL-USER> (make-record moose)
> (make-record :v<I>mage_<B>uffer) works fine, but if I try to use a
> variable, I get an error about not knowing the foreign type 'moose.
> Thanks again,
> Cyrus

MAKE-RECORD's a macro; it processes its first argument at macroexpand
time and expands any initialization forms in the macro call into
(SETF (PREF ...) ...) forms.

See <http://openmcl.clozure.com/Doc/re77.html>

"Processing the first argument at macroexpand time" -could- be done by
a non-macro function at runtime, at least in theory.  The processing
in question involves determining the size of the named foreign type or
record, and you -could- do that at runtime (and #_malloc and #_bzero a
pointer of that size, assuming that record/type definitions existed at
runtime.)  Would you want to do this ?

More information about the Openmcl-devel mailing list