Live data from Hacker News

Rich Harris joins Vercel to work on Svelte full time

twitter.com

271–280 of 571 posts

Re: Rich Harris joins Vercel to work on Svelte full time

#271

Earlier quoted context omitted.

JSX is JS. Nested brackets are simply converted to nested function calls & objects, attributes convert to properties. This is evident when comparing conditionals, loops, etc. Instead of learning template syntax you simply use JS syntax, albeit a declarative subset (no branches). JSX is simply syntactical sugar for nested JS, you can use it without, but it's prettier with. One could add this syntactical sugar natively…

I agree 100%... Adding JSX to the language spec would be interesting. It might be too heavy to include within the language spec as many JS applications do not involve the DOM at all, so then you have to essentially bundle DOM functions into every application... or common.js would omit this subset of the language.

It's actually a fairly small change (two new PrimaryExpressions), the spec is here:

https://github.com/facebook/jsx

Example parser from Acorn:

https://github.com/acornjs/acorn-jsx/blob/master/index.js

No part of JSX uses the DOM, it doesn't share anything with HTML.

The JS engine itself would need the modification.

Also JSX doesn't have to be for the UI, it could be for dialogs for an NPC in a game, for configs, etc.

edit: I agree with @proxyon, I'm really disappointed with HN that this simple fact is downvoted without retort.

The common sentiment here is wrong, JSX is a small extension to the grammar of JS. It is JS.

Re: Rich Harris joins Vercel to work on Svelte full time

#272

Earlier quoted context omitted.

What how can you say that??? {myItems.map({id, title}) => {title} } vs... svelte {#each myItems as item} {item.title} {/each} One is literally just javascript and html the other is an entirely different template language. You might say... JSX is not HTML... well it's very very similar... If you know HTML you JSX is very intuitive.

But React isn't just JSX. It's also the entire runtime library, hooks, event handling, forms, state handling, etc. The example you shared is a bit too simple to understand where Svelte shines because it doesn't introduce any of those concerns. By having it's own templating language, Svelte is able to compile the templates to JavaScript in a way that addresses many of those concerns in a way that I think it easier to…

[deleted]

Re: Rich Harris joins Vercel to work on Svelte full time

#273

Earlier quoted context omitted.

> If you know HTML you JSX is very intuitive. That's a poor assumption that appears to be based on your personal preferences and what you're comfortable with. I personally find both require some learning, but prefer the svelte version.

And JSX isn't JavaScript and it isn't HTML, and if you know JavaScript and HTML you still don't know JSX, so you're still using "yet another language" in addition to JavaScript and HTML.

Come on… If you know JavaScript and HTML you are 95% of the way to being fluent in JSX. It’s basically just JavaScript expressions.

Re: Rich Harris joins Vercel to work on Svelte full time

#274

Earlier quoted context omitted.

For all the use cases I deal with on a regular basis, Svelte looks more like vanilla HTML/JS than any equivalent React code. And the reason these things change is because that's what needed changing . One of the topline features of Svelte is that is has less boilerplate than React, and it achieves that quite handily. Unless you're criticizing particular constructs in Svelte that are unjustifiably different, I don't t…

What boilerplate does React have? Do you mean Babel?

I know...

This comment had no context...

You don't have to even

    import React from 'react';
anymore

Re: Rich Harris joins Vercel to work on Svelte full time

#275

I'm tired of having to learn yet another templating language without a very compelling reason. Why do I have to learn, what is essentially, a new programming language for each of these frameworks (Angular, Svelte, Vue, React... Do I really need to learn yet another language construct for stuff like `loops`, `if/else`, event handlers...etc. Why must all of these frameworks re-invent the wheel? At least with React it i…

My solution is pretty easy to this problem: I don't.

Re: Rich Harris joins Vercel to work on Svelte full time

#276
post #3

This seems like a huge positive step forward for Svelte and the community. Big congrats to Rich! I've been excited about Svelte for a while and recently chose to use it as the UI for a cross-platform video editing app ( https://getrecut.com ), with the back end in Rust. I've found it a pleasure to work with -- Svelte Stores and the Context system are especially great for sharing state, and the app feels snappy. Last…

Do you have a mailing list I can toss my email on for when this is available on Linux? Honestly I was ready to buy it instantly before I saw the platform limitation, but it would be even better if it could run some basic filters like removing pops and de-essing, which I always struggle to get working right in Audacity (I have a screenshot saved of my filter curve because Audacity doesn't save it, it's so stupid).

Re: Rich Harris joins Vercel to work on Svelte full time

#277
I have a stupid question:

The cool thing about Svelte is that it compiles your code in a way so that when variables change, bindings in HTML change, but only that HTML and not an entire DOM re-render. (Right?)

So, if this is the case, how come React couldn't do the same thing? They'd lose the ability to just include react in a script file, but why can't a smart compiler look at your JSX and throw out the virtual DOM component, so your variables are directly bound to where they're used in the HTML?

Re: Rich Harris joins Vercel to work on Svelte full time

#278
post #186

Earlier quoted context omitted.

As a backend guy who moved away from frontend long ago for these very reasons, I have to ask: why are people downvoting this? Is it wrong? I'm genuinely asking, because from a bystander's point of view, it certainly seems like the pattern of the Framework Du Jour hasn't really slowed down much in the frontend community.

Didn't downvote either. Almost consider upvoting for visibility of the hilarity displayed. "There are too many frameworks! Why does everyone keep re-inventing the wheel? Why can't everyone just use the one that I like? "

I never asked anyone not to use svelte... I said why should I be compelled to learn this new language, other than it being the hot new UI framework of the day.

It doesn't have a virtual DOM? It doesn't have synthetic events? Ok why not just use web components which provide their own encapsulation and vanilla JS. I don't have to learn a new language which may or may not be around/supported a few years from now... Also I'm continuing to grok web standards.

Re: Rich Harris joins Vercel to work on Svelte full time

#279
post #270
post #264

Earlier quoted context omitted.

It does have extra non-native features but the overarching format for single file components is plain HTML which makes it feel closer to vanilla than React.

Yeah I never really understood this benefit. The file structure is irrelevant to me after 15 minutes, the nitty-gritty semantics of my code are causing me headaches and bugs forever. (I like working with all 3 current frontend frameworks btw, not trying to start a flamewar)

I like it because it separates layout, styling, and scripting while still collating them in the same file.

Re: Rich Harris joins Vercel to work on Svelte full time

#280
post #277

I have a stupid question: The cool thing about Svelte is that it compiles your code in a way so that when variables change, bindings in HTML change, but only that HTML and not an entire DOM re-render. (Right?) So, if this is the case, how come React couldn't do the same thing? They'd lose the ability to just include react in a script file, but why can't a smart compiler look at your JSX and throw out the virtual DOM…

I actually think Ember/Glimmer happens to have the best implementation of this, where their diff can be incredibly optimised because they know the semantics of the template and can just skip all work on static elements and attributes that never change.
Post reply on HN