Live data from Hacker News

Introduction to Svelte

daveceddia.com

91–100 of 116 posts

Re: Introduction to Svelte

#91
post #89
post #79

Earlier quoted context omitted.

If you think of js bundle size as a percentage of average hard drive space or compare to a ratio of broadband speeds then 30 megs doesn't seem so bad.

Still, seriously? 30MB to print "Hello, World"? I can drive a Hummer H3 the block away to the 7-11 but wouldn't it be better if I at least try to ride my bike up there whenever possible?

Try checking the size of a typical C++ compiler plus supporting headers and libraries and comparing that. Same concept.

Re: Introduction to Svelte

#92
post #69
post #49

Earlier quoted context omitted.

This is literally the first time anyone has ever put together a cogent argument for why the framework du jour exists. Thank you! I still personally feel like I can usually get more done with pure Javascript but, as I said in my original post, at least they appear to be headed in a better direction. I did a project in Vue last year and it didn't entirely suck. Unlike the nightmare that was an Angular project I did two…

In an earlier comment, you said you weren't a "framework guy". If you were you would have heard this cogent argument dozens of times already as it's fairly common knowledge to people who are into frameworks. Consider trying to understand why frameworks are created before using them. Understanding the motivations behind a framework will help you navigate the api easily and could change your opinion about whatever frus…

I've used every one of the frameworks that I mentioned with the exception of Svelte, and am surrounded by framework users. Not a single one has ever made that argument. It's always, "Look at this new shiny framework, we must use it!"

And all of those frameworks were great right up until the point that my client or company had a product requirement that the framework designers hadn't though of and then, suddenly, the framework was working against me instead of for me.

Re: Introduction to Svelte

#93
post #50

Earlier quoted context omitted.

Svelte author here. That post overlooks a number of important points; I've responded here https://www.reddit.com/r/javascript/comments/ckpdxk/long_liv...

React is very far from the fastest vdom. It notably suffers from needing to work with non-DOM back-ends where a particular heuristic that is good in the DOM may either be useless or (worse) actively degrade performance. Preact, Snabbdom, or Inferno would probably be better points of comparison to Svelte's approach as they are much more optimized for the web. DOM nodes can actually be recycled relatively easily. Cache…

Either I have completely misunderstood you or you are simply wrong. It looks like you are implying that vdom is magical solution to long lists and svelte should have problem here. While in real world we have this: https://svelte.dev/repl/f78ddd84a1a540a9a40512df39ef751b?ver...

Re: Introduction to Svelte

#95

Earlier quoted context omitted.

> Imo Vue and Svelte are going backwards Big claims need big evidence.

I said in my opinion. I think going from JSX to templates is a bad idea and going back to where we were.

Vue supports "templates" (both es5 string and single file component compiled), JSX, jade/pug, and render function.

Svelte's single file components, similarly, are not "dumb string templates". The compiler applies some correctness checking onto them at build time.

Re: Introduction to Svelte

#96

Earlier quoted context omitted.

Some people are running around to new frameworks, but most are with React. Imo Vue and Svelte are going backwards.

> Imo Vue and Svelte are going backwards Big claims need big evidence.

https://npmcharts.com/compare/react,vue?interval=7&start=500

Vue adoption does seems to be tapering

(Naively looking at download counts)

Re: Introduction to Svelte

#97
post #83

Earlier quoted context omitted.

JSX is JavaScript. I do not have to learn a new language to iterate over an array. I can interact with it using whatever JS libraries I prefer. JSX components are functions or classes which are trivially composable. I can type functions and classes with typescript unlike string templates.

> I can interact with it using whatever JS libraries I prefer. Could you give an example with JSX where templating will not cut? > JSX components are functions or classes which are trivially composable. This is framework's feature IMHO not language's. > I can type functions and classes with typescript unlike string templates. Situation where types are important in other frameworks is JS part not templates part. Could…

> Situation where types are important in other frameworks is JS part not templates part. Could you give an example where typing is import purely in component's return value?

You will lose type-safety when composing components in template-based frameworks. It is jsx part where types are most important. Instead of getting runtime errors because you passed wrong props you get instant feedback from tsserver and compile error.

Re: Introduction to Svelte

#98
post #86

Earlier quoted context omitted.

JSX is JavaScript. I do not have to learn a new language to iterate over an array. I can interact with it using whatever JS libraries I prefer. JSX components are functions or classes which are trivially composable. I can type functions and classes with typescript unlike string templates.

> JSX is JavaScript JSX is decidedly not JavaScript, it is an extension to JavaScript. > I do not have to learn a new language to iterate over an array. Since you have to use map() and can't use a simple for-loop, not sure how knowing the language itself helps or not. Either way, loops and conditional are really the basics, you pick it up in a day or two for any template syntax. > I can interact with it using whateve…

> JSX is decidedly not JavaScript, it is an extension to JavaScript.

No, JSX is JavaScript. You can write it in function calls or JSX, it's just syntactic sugar.

> Fair enough, but this prevents many optimizations because the render method can produce virtually anything.

No, using a library doesn't mean the function used from the library isn't pure. Yes it could have side-effects, but the point is you aren't restricted. You can use pure functions or anything else.

> In any case, since svelte is a compiler, it should be possible to type-check components as well.

Yes. But it doesn't, and you get it for free because TSX is just TypeScript. If wishes and buts were candy and nuts...

Re: Introduction to Svelte

#99
post #69
post #49

Earlier quoted context omitted.

This is literally the first time anyone has ever put together a cogent argument for why the framework du jour exists. Thank you! I still personally feel like I can usually get more done with pure Javascript but, as I said in my original post, at least they appear to be headed in a better direction. I did a project in Vue last year and it didn't entirely suck. Unlike the nightmare that was an Angular project I did two…

In an earlier comment, you said you weren't a "framework guy". If you were you would have heard this cogent argument dozens of times already as it's fairly common knowledge to people who are into frameworks. Consider trying to understand why frameworks are created before using them. Understanding the motivations behind a framework will help you navigate the api easily and could change your opinion about whatever frus…

I'd also consider myself not a "framework guy" -- Spring is not my favorite, I pick flask/sinatra over rails/django, servant over yesod, vue + vue-router over ember (these days) etc.

Maybe the distinction is that it really matters which framework, and how it's put together, and how much you have to commit to use any of it.

I think the commenter's question was really more about the diaspora of these tools and why they all exist -- svelte is pretty decidedly not a framework (in fact I don't even think you can make it one, AFAIK there isn't like a "svelte data"). IMO the only full blown frontend frameworks are Ember, Angular and react/vue + react/vue-router + flux-y pattern data store.

Re: Introduction to Svelte

#100
post #49

Earlier quoted context omitted.

This is literally the first time anyone has ever put together a cogent argument for why the framework du jour exists. Thank you! I still personally feel like I can usually get more done with pure Javascript but, as I said in my original post, at least they appear to be headed in a better direction. I did a project in Vue last year and it didn't entirely suck. Unlike the nightmare that was an Angular project I did two…

Oh definitely -- when you can get stuff done with pure javascript it's beautiful -- but once you notice yourself doing too much, it's time to pick one of these small frameworks. BTW, you should check out Mithril[0], it's my current favorite, it's very small and self-contained yet very complete. It's got a slow, cautious moving community, and just enough of what you need and virtually nothing you don't -- very easy to…

Commenting on my own comment, but Polymer[0] also deserves some love! v3 looks really amazing ergonomics wise, and it's the most web-standards friendly. The early demos of polymer (some showing being able to just drop a on your plain HTML page) really were mind-blowing. Also, it's actually in use on a bunch of google properties, like Youtube (you can actually see on some of the older pages that some URLs have a some use_polymer query parameter that turns it on/off).

Polymer is really interesting because it represents a kind of return to the early web but with all the new-web thinking -- just drop some custom component on your page (so only needing to think in HTML) and you're good to go.

[0]: https://polymer-library.polymer-project.org/3.0/docs/about_3...

Post reply on HN