Re: [racket-users] Re: Is this "inside out" macro technique common?

2021-08-18 Thread Michael Ballantyne
> I think there is a bug in the documentation (or maybe in Racket) because when I try `(syntax-local-eval #'(begin e ...) #f)` Thanks for the report, I submitted a PR with a fix (https://github.com/racket/racket/pull/3964). Referring back to your original message, > (Of course, if I had more

Re: [racket-users] Re: Is this "inside out" macro technique common?

2021-08-17 Thread Ryan Kramer
Thank you! `splice` is indeed the essential primitive here, so it's nice to see it extracted and named properly. The difference between eval-syntax and syntax-local-eval is good to know also. I think there is a bug in the documentation (or maybe in Racket) because when I try

Re: [racket-users] Re: Is this "inside out" macro technique common?

2021-08-16 Thread Michael Ballantyne
The essential primitive here seems to me to be: (define-syntax (splice stx) (syntax-case stx () [(_ e ...) (eval-syntax #'(begin e ...))])) With with-quasisyntax being: (define-syntax-rule (with-quasisyntax ([a b] ...) template) (splice (with-syntax ([a b] ...) (quasisyntax

Re: [racket-users] Re: Is this "inside out" macro technique common?

2021-08-13 Thread Ryan Kramer
The name `with-quasisyntax` is not very good, because it is not simply a quasi version of `with-syntax`. The most interesting part is that it calls `eval-syntax` up front. The result feels like a "universal macro" -- it can be used to implement both foo->assoc and assoc->foo which look like they

[racket-users] Re: Is this "inside out" macro technique common?

2021-08-13 Thread D. Ben Knoble
Ah, I'm now seeing that with-quasi implicitly #`s the body; I believe with syntax-parse, #:with, and #' + template vars + #` when needed you might be ok. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop

[racket-users] Re: Is this "inside out" macro technique common?

2021-08-13 Thread D. Ben Knoble
> A shortcut to answering my question would be to tell me that `with-quasisyntax` in the following paste already exists: http://pasterack.org/pastes/48885 Without taking a detailed look, is there anything about with-quasisyntax that with-syntax