Using with-slots in a macro
Is this generally considered bad form and will break macros (akin to the reason gensym exists)?
What's the typical way to handle this? Just always use accessor functions for slots?
Just in case the above isn't clear enough... here's an example:
(defstruct foo bar)
(defmacro dummy-macro ((sym value) &body body)
`(let ((,sym ,value))
(with-slots (bar)
,sym
(progn #| do something with bar |# ,@body))))
Now I end up using it like so:
(let ((bar ...))
(dummy-macro (k v) #| do something with bar |#))
I'm pretty much borked here, right?
Follow-up question:
Is the above "okay" assuming that the macro exists in one package and the use of the macro exists in another package? In that case, the with-slots would actually be referencing my-package::bar and the usage code would be using cl-user::bar (as an example). Is it still bad form, though?
Jeff M.