From: Douglas K. <do...@go...> - 2014-08-04 15:06:17
|
> But what if quasiquote expanded to a quasiquote-identity form? I'm not > sure if it's being > proposed for real, but it's interesting nonetheless. > This was definitely a real suggestion. I think it's not terribly deceiving since you can always write a form as non-pretty. But it sounds like opinions lean toward macroexpand-all just doing what I had proposed as macroexpand-all-except-quasiquote, is that right? While we're saying this is legitimate in account of possible treatment of quasiquote as a special operator, there is actually no special handler in either the compiler or the interpreter. We're justifying why it would be ok for macroexpand-all to decide that any old random macro could be transformed into a different use of that very same macro as long as expansion terminates somewhere. That's fine with me. Also, it seems that formerly macroexpand-all's operation on comma-fied forms prior to the backq change was doing what we've said users shouldn't rely on. ``(,,(pop (car x)) ,(incf result) ,a) is (SB-IMPL::BACKQ-LIST* (QUOTE SB-IMPL::BACKQ-LIST) (POP (CAR X)) (QUOTE ((INCF RESULT) A))) But macroexpand-all works because stuffing the expansion of (pop (car x)) into the second arg of backq-list* does something sane. It's hard to imagine why that would be untrue, but I think it is nifty to provide macroexpand-all hooks that allow transforming (some-macro (pop x)) -> (some-macro (let* ((#:x ....))). You'd have to write the partial expander for each macro that you wanted to have this capability for. quasiquote is but one example where it becomes extremely desirable. -all-except-quasiquote was too ad-hoc for my liking. One last thing: I'm pretty sure that quasiquote's expansion needs to use only the standard list constructors when being called for COMPILE and not COMPILE-FILE. (Or rather, any functions would be ok - ANSI or non-ANSI - that aren't foldable) COMPILE is not allowed to collapse constants, so we should skip the IR1 transforms for foldable list constructors. [Unless someone has a different interpretation of the issue about exactly how constant backquoted lists are, I think it's safer to remove the interesting behavior from COMPILE. And Paul's original change should have done that but it would have been impossible] As such, I've changed the code so that DEFINE-COMPILER-MACRO QUASIQUOTE expands using the SB-IMPL functions but DEFMACRO QUASIQUOTE expands using ordinary LIST,APPEND,etc. This change is orthogonal. I have no new patch yes. Just waiting for more clarity on which direction to go. |