Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because Svelte can look through the template, and at compile-time determine exactly which parts of the output need to be "surgically updated" in the DOM when some of the inputs change, without needing any runtime like a virtual DOM implementation. I don't know how you could implement such a thing (with good ergonomics) without a template language.


SolidJS[https://www.solidjs.com/] does exactly that. That ability is more about fine grained reactivity than it is about templates. The use of templates and single file components is a stylistic choice by the Svelte team. You could argue Solid has poor ergonomic compared to Svelte I guess.


> I don't know how you could implement such a thing (with good ergonomics) without a template language.

Parse Javascript? I don’t see how it would be any different, except you have more constructs to work through.


The "more constructs to work through" is precisely the problem. Without restricting JavaScript to some subset, you're not going to be able to statically determine the behavior of any given program.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: