News for hackers. Stuff that matters.
Re:A JavaScript parser and interpreter written in Go by Loic on Thursday November 28, 2013 @03:02AM (#6813541)
In the case of web application, you can have the same templating engine running in the browser and in the server. This means rendering the full HTML at the server level if needed or part of it or just at the browser level. You get a bit of freedom. It is painful to manage two different templating engines between the server and browser sides.
Re:A JavaScript parser and interpreter written in Go by yeukhon on Friday November 29, 2013 @03:34AM (#6818440)
I don't get it. Are you saying - okay let's replace the javascript run time in today's browser to this version in Go?
Re:A JavaScript parser and interpreter written in Go by furyofantares on Friday November 29, 2013 @01:43PM (#6820491)
I don't think he's saying that. I think he's saying your Go server could execute similar JavaScript as the client executes.

Imagine a highly dynamic web page, beyond the initial page load when you interact with the page javascript executes the user's actions then rewrites large chunks of the page. As a developer, you need to write code on your backend that knows how to render the initial HTML for the page, but then you have to duplicate this functionality in JavaScript since the client needs to be able to render any chunk of the page that changes in response to a request.

You have a few options as a developer here. You can live with maintaining two code paths in different languages that do essentially the same thing. Or you can get rid of the backend rendering entirely, making your page less friendly to no-script users and web crawlers (and sometimes making the site flicker a bit as content gets loaded initially for all users.)

Or you can use shared code on the backend and the client for rendering HTML by having a backend that speaks JavaScript.