Hmm while i was looking for a way to find the arguments of a macro i stumbled upon symbol-macrolet
, the following should be able to prevent people needing to deref: (untested)
Code: Select all
(defmacro these-deref ((&rest vars) &rest body)
`(symbol-macrolet (,@(loop for v in vars collect `(,v (deref ,v)))) ,@body)
(defmacro pointerize ((&rest vars)) ;Rest here is just handy fluff.
`(let (,@(loop for v in vars collect (if (listp v) `(,(car v) (make-pointer ,(cadr v))) `(,v (make-pointer nil))))
(these-deref (,@(loop for v in vars collect (if (listp v) (car v) v)))
(defmacro pointerize-var ((&rest vars) &body body)
`(pointerize (,@(loop for v in vars collect `(,v ,v)) ,@body))
@gugamilare: i associate using the first element of a list as a reference with pain. That might be because programming non-functionally can cause trouble, or just because i was not as good a programmer back then, though.