Can someone please help me understand why calling baz() doesn't really seem to redirect in "/bar" ( seems to falls through)? I thought templates expanded verbatim inline (for untyped expressions at least) -- or have I got this completely wrong?

import jester, asyncdispatch, htmlgen

template baz() =
    redirect "/foo"

routes:
    get "/foo":
        resp h1("in foo")
    get "/bar":
        #redirect "/foo"
        baz()
        resp h1("uh oh!")

runForever()

2017-11-13 17:28:50

Ok, the following piece of code works in line with my basic understanding of templates so far. So I take it the above must be a bug in Jester then? @dom96 Can you please share your thoughts if you have a minute? I'd be much obliged!

template foo() =
    if i == 5:
        break

for i in 1..10:
    foo()
    echo i

2017-11-14 16:44:02
This a side effect of how Nim's templates interact with macros. The route in jester is a macro, and the redirect is a template. So I don't know if there is a way to solve this.
2017-11-14 19:08:08
Ah I see. Thank you very much for your insight Dom. Guess I'll just inline for now then. 2017-11-15 04:28:31