4 ms·
Congratulations on the launch, Rich! It's looking like we're really starting to approach the form and function of what "a language to build the web" ought to be
by jashkenas 8y ago
Congratulations on the launch, Rich! It's looking like we're really starting to approach the form and function of what "a language to build the web" ought to be.
One small question about some of the pragmatic choices in Svelte 3: What was the decision process behind choosing to smuggle the new reactive features under a "standard" JavaScript skin? ($:, export let, etc.) Is it just to avoid needing to rewrite all existing JS tooling — parsing, syntax highlighting, linting — or is there something deeper going on?
- rich_harris 8y agoThanks Jeremy! As I've expressed elsewhere, observablehq.com provided important inspiration. I've also been influenced by your own comments in the past about a language for building web apps. It's exactly that — there's so much tooling in the JS ecosystem that we can lean on, and by inventing new syntax we'd be throwing all that away. It'd be great if we could do `prop answer = 42` and `a <= b`, but it's just not worth it — once you get used to `export let` and `$: a = b` it quickly becomes second nature, we've found.
- pier25 8y ago> I've also been influenced by your own comments in the past about a language for building web apps Hey Rich have you seen Imba? http://imba.io/ http://imba.io/ It's not reactive, but it doesn't need to since everything is memoized. I think it's interesting that they made their own language to solve the front end problem. They used it to build https://scrimba.com/ https://scrimba.com/ which is pretty awesome.
- rich_harris 8y agoI have seen it, yes. I'm impressed by the ambition, though I think that in the long term it's better to work with the grain of the platform by extending the web's existing languages rather than creating a new one. Memoization certainly makes Imba a lot faster than VDOM-based frameworks. Of course, it's only really beneficial when not many things have changed!
- dfabulich 8y agoCan you say more about this? Your article says about `count += 1` that "we can do all this without the overhead and complexity of using proxies or accessors. It's just a variable." But it's not just a variable; it's a magic variable that $$invalidates its contents. I'd be much happier to write `state.count += 1` and allow my debugger to step into the proxy in dev mode, but then have the production compiler convert the proxy into a direct call to $$invalidate to minimize runtime overhead and support legacy non-proxy browsers.
- rich_harris 8y agoFirstly, that's more code you're having to write (and object property names don't typically get mangled, so you'll end up shipping more code as well as writing more code). Write less code! https://svelte.dev/blog/write-less-code https://svelte.dev/blog/write-less-code You can easily debug reactive variables, either using the `{@debug ...}` tag in the template (https://svelte.dev/examples#debug https://svelte.dev/examples#debug) or by using `debugger` in your script tag (https://svelte.dev/repl?version=3.0.0&gist=adc35e969343aad6026c7dd3836aa426 https://svelte.dev/repl?version=3.0.0&gist=adc35e969343aad60...).