Re:Fun - a new programming language for the realtime web
by marcuswestin on Monday August 09, 2010 @03:35PM
(#1589087)
Absolutely!
You can declare something akin to a function, which takes arguments and emits HTML. Imagine e.g.
let taskTemplate = template(task) {
<div class="task">
<span class="title">task.title</span>
</div>
}
for (task in tasks) { taskTemplate(task) }
I'm not decided on syntax yet.You can definitely separate out logic from template this way.
Fun outputs javascript, not HTML - the javascript then builds the DOM.
Re:Fun - a new programming language for the realtime web
by m0th87 on Monday August 09, 2010 @05:41PM
(#1589514)
But it still outputs something that is only consumable by web browsers. It seems to me like the potential productivity gains you'd get out of Fun would only be for tightly coupled systems where you're not worried about exposing an API, and all clients use web browsers.
How would you go about reusing code? Could you potentially separate out logic from your template?
I would also like to see how this could be done more unobtrusively. It would also be good to show what the output html looks like after it is compiled to html.