Conversation
|
|
||
| {% endnote %} | ||
|
|
||
| ## Compiler |
There was a problem hiding this comment.
I'd be more explicit here about the fact that this results in potentially better long-term maintainability: the compiler acts as a buffer between Svelte and the platform so that Svelte code doesn't need to change when the platform changes or develops further -> better long-term maintainability and more long-term safety for investments into Svelte
There was a problem hiding this comment.
Isn't this basically the third point?
There was a problem hiding this comment.
It's implied in your 3rd point but not explicit
BlueCutOfficial
left a comment
There was a problem hiding this comment.
I haven't read the whole article yet, just the first section. I'll get back to it on Tuesday if not merged yet.
|
|
||
| In this talk Rich showcased the idea of moving the reactivity from the runtime into the language itself. A compiler! Just like in the good ol days a C compiler could help you write programs in an easier way by writing the ASSEMBLY code for you, Svelte can help you write websites in an easier way by writing Javascript code for you. Being a compiler is the first reason why I would choose Svelte and this has several implications: | ||
|
|
||
| 1. **New language constructs**: a compiler gives you a superpower...if you write a JavaScript variable in an HTML file you can't use it in the template below. In Svelte you can! This is powered by the compiler that turns your template into JavaScript expressions that are in the same scope as your variables. |
There was a problem hiding this comment.
What do you mean by "below"? I am not sure to view the use case you're thinking of.
There was a problem hiding this comment.
Just a description of the fact that in svelte you can do this
<script>
let x = 42;
</script>
<div>{x}</div>and in HTML you can't
| 2. **Write efficient code by default**: many C developers could not write ASSEMBLY as efficiently as `gcc` can...the same is true for JavaScript. Sometimes it can be difficult to write efficient code but the Svelte compiler is written by a lot of very smart guys (and me) that knows how to write efficient JS for you. | ||
| 3. **Ability to change the runtime without changing the syntax**: another somewhat hidden feature of a compiler is that you can change the underlying runtime without having to change the syntax. We recently released Svelte 5 which, to be fair, was quite the syntax change...but you can still use your old component in Legacy mode. The same syntax, now use a completely different technology under the hood (compile time reactivity vs signal based reactivity). If tomorrow a brand new technique much better than signals is discovered Svelte can pretty much just rewrite the runtime without change the syntax. | ||
|
|
||
| Another very good example of the power a compiler gives you is the brand new experimental `await` API: since the compiler does not abide to the rules of JavaScript you can use `await` in the middle of your script tag or component template and retain the signal based reactivity even after the `await` or we can `Promise.all` all your `await`'s in the template so that they don't waterfall. |
There was a problem hiding this comment.
| Another very good example of the power a compiler gives you is the brand new experimental `await` API: since the compiler does not abide to the rules of JavaScript you can use `await` in the middle of your script tag or component template and retain the signal based reactivity even after the `await` or we can `Promise.all` all your `await`'s in the template so that they don't waterfall. | |
| Another very good example of the power a compiler gives you is the brand new experimental `await` API: since the compiler does not abide to the rules of JavaScript you can use `await` in the middle of your script tag or component template and retain the signal based reactivity even after the `await`; or we can `Promise.all` all your `await`'s in the template so that they don't waterfall. |
|
|
||
| Another very good example of the power a compiler gives you is the brand new experimental `await` API: since the compiler does not abide to the rules of JavaScript you can use `await` in the middle of your script tag or component template and retain the signal based reactivity even after the `await` or we can `Promise.all` all your `await`'s in the template so that they don't waterfall. | ||
|
|
||
| All of this is only possible because svelte it's a compiler which means it will allow users to write code in the most intuitive and logical way but still apply all the code changes required for it to work. |
There was a problem hiding this comment.
| All of this is only possible because svelte it's a compiler which means it will allow users to write code in the most intuitive and logical way but still apply all the code changes required for it to work. | |
| All of this is only possible because Svelte is a compiler, which means it will allow users to write code in the most intuitive and logical way, but still apply all the code changes required for it to work. |
|
|
||
| All of this is only possible because svelte it's a compiler which means it will allow users to write code in the most intuitive and logical way but still apply all the code changes required for it to work. | ||
|
|
||
| Now, some people are scared about a compiler touching their code, but here's something that not a lot of people realize: basically every framework is using a compiler of some sort. React is doing a minimal conversion only transpiling JSX to `Rect.createElement`, Solid is doing a slightly heavier transformation that still only concerns the JSX part, Vue an even heavier compilation which still mostly touches the template part. |
There was a problem hiding this comment.
Since we're listing frameworks, this section could mention Ember.
BlueCutOfficial
left a comment
There was a problem hiding this comment.
Second part of the early review :)
|
|
||
| ## Optimize for the vibes | ||
|
|
||
| Quoting Rich Harris [once again](https://github.com/sveltejs/svelte/discussions/10085), one of the tenets of Svelte is "Optimize for the vibes". Nowadays vibes took a bit of a negative turn with "Vibe coding" but the reality is that one of the design goals of Svelte is |
There was a problem hiding this comment.
Earlier the link was on the concept "Rethinking Reactivity" so I think it's better to keep the same pattern.
| Quoting Rich Harris [once again](https://github.com/sveltejs/svelte/discussions/10085), one of the tenets of Svelte is "Optimize for the vibes". Nowadays vibes took a bit of a negative turn with "Vibe coding" but the reality is that one of the design goals of Svelte is | |
| Quoting Rich Harris once again, one of the tenets of Svelte is "[Optimize for the vibes](https://github.com/sveltejs/svelte/discussions/10085)". Nowadays vibes took a bit of a negative turn with "Vibe coding" but the reality is that one of the design goals of Svelte is: |
|
|
||
| You might argue that vibes are subjective but the fact that the design decisions around the framework strive specifically to make the framework the most intuitive have consequences on the engineering side. | ||
|
|
||
|  |
There was a problem hiding this comment.
Could this alt text be displayed in the post as well?
There was a problem hiding this comment.
Honestly, dunno
|
|
||
|  | ||
|
|
||
| Svelte is constantly the most interesting framework in online surveys: developers wants to learn Svelte! |
There was a problem hiding this comment.
If it's just an explanation of the image above, I wouldn't use the plural for survey, I would rather use "State of JS".
There was a problem hiding this comment.
It's not just an explanation of that...Svelte is generally on top in different online surveys...the image is just one of them
There was a problem hiding this comment.
But then what surveys? Because this way I feel like it's an assertion that is not backup by sources.
There was a problem hiding this comment.
Fair...will list a few
Pushing this already (obviously it's not finished at all) because since it's a bit of a weird one I think it's important to get feedback immediately to not rewrite everything in case it's not the direction we want to go towards.
RENDERED VERSION