The great thing about macros is that they can inspect their arguments and decide what to do with them; this is what anarki's 'def does in order to generate doc-strings. If the first element of the 'body arg is a string, use that to document the function currently being defined. Similarly, we could say if the first element of paginate's 'body arg is, say, a hash, use that hash as keyword args, and use (cdr body) for the body.
Using {...} syntax for the hash, this could even be elegant:
, in this case 'paginate checks if the first element of its 'body arg is a list beginning with 'opts. Something like the following (completely untested)
Yes, I thought about adding a set of parens around either keyword or rest params. The brace syntax sounds decent. I think it works just as well; it's just a question of what syntax people prefer.
You'd still need support for defaults in extract-opts. Complexity-wise I think the two implementations would be equivalent.
Hmm, one benefit of using a separator like :do: In macros that need just keyword args the opts approach would add redundant syntax to each call.
I don't understand the entire state space here, but I used to think arguments should go into rest params by default, and now I think they should go into keyword args. What do you think?