[racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
I would like to take the following web request handler: (define (login request) (render-string (include-template "../views/authentication/login.html"))) and eventually get to something like: (define (login request) (render login)) My current lack of understanding with respect to macros i

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 8:25 AM, Brian Adkins wrote: > > But, I'm guessing that the include-template macro is unable to consume the > output of my view macro. Is there anything I can do to get (view login) to be > expanded prior to when include-template needs it? Wrap `include-template` with yo

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 1:45:43 PM UTC-5, Matthew Butterick wrote: > > > On Feb 19, 2019, at 8:25 AM, Brian Adkins > wrote: > > But, I'm guessing that the include-template macro is unable to consume the > output of my view macro. Is there anything I can do to get (view login) to > be ex

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 4:03:02 PM UTC-5, Brian Adkins wrote: > > On Tuesday, February 19, 2019 at 1:45:43 PM UTC-5, Matthew Butterick wrote: >> >> >> On Feb 19, 2019, at 8:25 AM, Brian Adkins wrote: >> >> But, I'm guessing that the include-template macro is unable to consume >> the ou

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 1:28 PM, Brian Adkins wrote: > > Oops - I spoke too soon. It appears the lexical context is unavailable to the > template when include-template is used in this manner. Ah right, one has to inject STR into the same lexical context, like so: #lang racket (require web-s

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 5:06:32 PM UTC-5, Matthew Butterick wrote: > > > > On Feb 19, 2019, at 1:28 PM, Brian Adkins > wrote: > > Oops - I spoke too soon. It appears the lexical context is unavailable to > the template when include-template is used in this manner. > > > Ah right, one ha

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 2:33 PM, Brian Adkins wrote: > > Awesome - that did the trick. I'm confused as to why it helped to inject STR > into the lexical context - it ends up being just a string, and it was working > fine with respect to loading the template. I would think the fix would be to >