Sometimes metaprogramming (macros etc) is a useful technique for refactoring, simply because you can try and then discard different designs: https://blog.metaobject.com/2018/11/refactoring-towards-language.html (I've certainly written then thrown away macros when writing Lisp!)