4 ms·
I also like svelte but as a compiler-y person who happens to be doing some JS I can't work out why I'm annotating so much stuff by hand (even with svelte 5). I
by mhh__ 3y ago
I also like svelte but as a compiler-y person who happens to be doing some JS I can't work out why I'm annotating so much stuff by hand (even with svelte 5). I can get why you might want this for react, but isn't svelte a compiler? Can't we do dataflow analysis?
I'm 50% convinced there's a Chesterton's fence I'm mising but where?
- 698969 3y agoYou can only do so many compiler-y things in a dynamically typed language like Javascript. And even less of it within the context of a single file, unless you implement a bundler (web jargon equivalent of linker). Otherwise by the time the run-of-the-mill bundler is done connecting parts of your component tree into a single file, so much of the high-level information of the component is lost that you can't really do much analysis on it. At least that were the reasons I saw when I was thinking about the same. If anyone has ideas around it, please get in touch.
- mhh__ 3y agoBut with a svelte component it knows a lot about the state, inputs, outputs etc. The default paths should be pretty easy to analyze as long as you pick sensible defaults.
- explaininjs 3y agoKind of an aside, but I can’t stand how in Svelte the statement “foo = foo” is semantically meaningful.
- jamauro 3y agoI think this will no longer be necessary in Svelte 5. We’ll see.
- kevindamm 3y agoIt sounds like you would appreciate Vue3 and its <script setup> mode, the compiler does a lot of ref() and data flow analysis to make the code for components very readable.
- TehShrike 3y agoI believe the constraints chosen could be summarized as 1. the code you write must parse as valid JS 2. you must be able to write traditional JS 3. we want the equivalent of the Destiny Operator https://paulstovell.com/reactive-programming/ https://paulstovell.com/reactive-programming/