The Toubleshooting and Tips FAQ for Web-server indicates that this is the
case
http://docs.racket-lang.org/web-server/faq.html
It explains how templates are compiled into the program, and then at the
very end "If you insist on dynamicism, there is always eval."
On Wed, May 15, 2013 at 7:46 PM, S
On Wed, May 15, 2013 at 4:19 PM, Neil Van Dyke wrote:
>
> 1. You are using eval because you *necessarily* have arbitrary Racket code
> coming into your application from outside at run time? Or because the
> libraries you are using seem to want you to use "eval"? The former reason
> is legitimate
Two comments on this code:
1. You are using eval because you *necessarily* have arbitrary Racket
code coming into your application from outside at run time? Or because
the libraries you are using seem to want you to use "eval"? The former
reason is legitimate, but rare. If the latter reason
BTW here's the technique I devised, in case it's useful to others.
; define the values you need for include-template
(define body-for-template "content")
(define template-name "template.html")
(define page-result
(parameterize ([current-namespace (make-base-empty-namespace)]
Glad to hear you got something working. I'm cc'ing the list again in case
someone who knows more about the web-server/templates library has any
suggestions.
Robby
On Wed, May 15, 2013 at 10:37 AM, Matthew Butterick
wrote:
> Probably more products should have an FHQ (Frequently Hopeless Question
Probably more products should have an FHQ (Frequently Hopeless Questions)
in addition to an FAQ.
I'm making a web-page generator that uses include-template from
web-server/templates. I need to set the template inputs & the template
itself at runtime, and collect the output.
I tried doing it with
The short answer is that the top-level is hopeless, as Matthew has
discussed at some length here and elsewhere.
If you really need to eval code, can you first put it into a module?
Robby
On Tue, May 14, 2013 at 11:09 AM, Matthew Butterick
wrote:
> Suppose x-is-foo.rkt is this:
>
> (module x-is
Some more excavation into the docs revealed that the preferred technique is
to use namespace-require for the initial import only, and then use eval
statements for the rest. That helped me resolve a difficult bug. But it
didn't resolve this variable-override mystery, because this:
#lang racket
(req
Suppose x-is-foo.rkt is this:
(module x-is-foo racket
(define x 'foo)
(provide x))
If you open another file and try this:
(require "x-is-foo.rkt")
(define x 'bar)
You'lll get a "identifier already imported" error. OK, that much I
understand.
Here's the question. When you do this:
(paramet
9 matches
Mail list logo