This would be a highly nontrivial endeavor.
What you would have to do is write a lambda-list analyzer which would
- Find all variables to be bound
- Replace them with gensyms (or use
copy-symbol
for total unreadability of the macroexpansion :-) and keep a map from the old symbols to the new ones.
Return something like
(destructuring-bind (new-lambda-list)
expression
(setq old-var-1 new-gensym-1 ...))
The analyser is present in any Common Lisp implementation (see, e.g., the link above) and it is not simple.
I suggest that you ask yourself whether destructuring-bind
is really not enough.