Templates: having got javascript to run on the server, There are 3 components on how web-apps are normally written: Model/Controller/View. For the Model Controller - we can leave that upto the application designer to come up with 101 frameworks. But for the View we are a bit lacking at present. you would have to do something like this: println("...(dont forget to escape the quotes........." + htmlescape(myvar) + "..."); Outputting as we go ________________________________________________________ While PHP's dump as we go concept is nice, I'm not sure it has a real advantage, unless you are dealing with huge data sources. The problem is that it would be klunky as soon as you start handling loops etc, to differ to far from the concept of compiling an application... We could make the exception to this: The lexer could work out the {} depth - if RAW code is being parsed and our depth = 0 (eg. top level) = This would mean we would have to call the execute routine as we switch back into direct output mode: eg. .... HTML TEXT ... (output as we go) javascript..... { ... HTML TEXT .... (treat this as println(.....THE TEXT....)) } ... end javascript >>>call execute on current scope here - flush the list of commands in global function (but dont clear the defined variables) ....HTML TEXT .... Complex language handling ___________________________________ Our simple hander can just deal with variables interpolated. A template compiler would be the best way to handle anything more comples (eg. turn flexy:foreach="...." attributes into javascript blocks... Code is run as a javascript file (just like any bash script) ___________________________________________________________________ Other methods: ... like PHP, escape in and out of HTML with etc. --> complex needs to hook into tokenizer .. --> easier to add syntax to JS?? something un-ambiguous??? println(?> .... everything here treated as string...? String interpolation. ____________________________________ should we interpolate variables here! maps to ....xxx" + htmlescape(somevar) . vvv + " or more standard versions... {xxxxxxx} Preventing String interpolation ____________________________________ ??> ..... ___________________________ .. in HTML .. in JS .. in ESCAPED JS... If we use {....} (which can not have