News for hackers. Stuff that matters.
Re:Thoughts on Svelte(Kit), one year and 3B requests later by ravenstine on Thursday June 22, 2023 @08:19AM (#36430996)
It's a new language? Maybe I missed something, having taken a break from Svelte for the last 6 or so months, but I'm pretty sure it's not a "new language" by any stretch of the imagination. Svelte is just JavaScript, syntactically speaking, and some of the language behavior is overloaded to support reactivity. Are you referring to its template language? There isn't anything particularly complex about that either, and it's a lot simpler than other templating languages like Handlebars (which seems to have inspired it).
Re:Thoughts on Svelte(Kit), one year and 3B requests later by 10xDev on Thursday June 22, 2023 @08:47AM (#36431313)
Reactive declarations that work using syntax outside of JS thanks to the compiler does make it a bit more than just JS. https://twitter.com/youyuxi/status/1057291776724271104
Re:Thoughts on Svelte(Kit), one year and 3B requests later by pcthrowaway on Thursday June 22, 2023 @09:36AM (#36431954)
Kind of like how JSX is actually JSXScript, sure
Re:Thoughts on Svelte(Kit), one year and 3B requests later by zdragnar on Thursday June 22, 2023 @10:01AM (#36432314)
JSX is, imho, more akin to a macro; the syntax is replaced with simple expressions. Technically, the JSX syntax isn't even necessary to use React, though most people prefer it.

Svelte bakes itself fully into your code in a way that you can't do without the compiler and still be using svelte.

Re:Thoughts on Svelte(Kit), one year and 3B requests later by waboremo on Thursday June 22, 2023 @01:33PM (#36435764)
JSX is necessary to use React otherwise you create even more footguns in a library that's littered with them.
Re:Thoughts on Svelte(Kit), one year and 3B requests later by cassepipe on Thursday June 22, 2023 @02:09PM (#36436309)
So you're saying that svelte does not just transpiles to js/css/html ? Could you expand on that a bit more ?
Re:Thoughts on Svelte(Kit), one year and 3B requests later by zdragnar on Thursday June 22, 2023 @11:56PM (#36442614)
The point is that Svelte is a full compiler- you cannot "use svelte" without it.

JSX is an essential, yet entirely optional, concept in React. The output of the transform is incidental to the actual behavior of React, the library.

As such, I wouldn't think it warrants the term "JSXscript" or whatever the post I replied to used.

Depending on how your tool chain is set up, you don't need a custom file extension like ".jsx" for files that need the transform, and React doesn't care about file extensions at all.

Svelte, on the other hand, pushes you to use the ".svelte" extension, mixing and matching tags, changing scoping rules, and so forth. If you were to write by hand what it puts out, you're not really using svelte anymore. It is, in this sense, elevated itself to a language superset.

I'm not arguing one is better or worse, just pointing out why I think they are sufficiently different to quibble over semantics.