News for hackers. Stuff that matters.
Re:If Not SPAs, What? by irrational on Wednesday October 28, 2020 @11:08PM (#24926737)
I have a theory. In the old days web development was looked down upon by "real" programmers. But then the WWW really took off and people started moving over from the C/Java world into the world of JavaScript. These are the people that insanely complicated web development when they tried to make it as complicated as the development world they came out of.
Re:If Not SPAs, What? by muzani on Wednesday October 28, 2020 @11:22PM (#24926826)
JS is quite a hacky language. Trying to turn it into Java neuters some of the benefits of being hacky (I'm looking at you, Typescript).

But at some point, it's neither a hacky Lisp like language, nor is it stable like Java or C++. It's just a middle ground that does these things poorly.

It would be nice to have a new programming language from scratch built to handle all the async/reactive mess. But until then JS is our best bet.

Re:If Not SPAs, What? by brendanmc6 on Thursday October 29, 2020 @12:22AM (#24927185)
I hear this so often, so as an exclusively js/ts dev I have to ask... what about this is “done poorly”?

```

try {

  return await fetch(url);
} catch (e) {

  handleError(e)
}

```

Because that (metaphorically speaking) is 90% of what I write. Throw in the occasional closure, `map()` or `reduce()`

My day to day headaches are never from TS, and always from unpredictable DOM api/layout/style behavior.

I guess I just don’t have any frame of reference for how “nice” a language can be. Is it just that JS has so many “bad parts” and footguns that I’ve gotten good at ignoring?

Re:If Not SPAs, What? by tofuahdude on Thursday October 29, 2020 @01:40AM (#24927611)
Fyi return await is redundant and is just creating one additional callback you didn't need (b/c you will have to call this function with an await anyways)
Re:If Not SPAs, What? by chain-- on Thursday October 29, 2020 @04:50AM (#24928463)
Try / catch is the exception, if you don't await then your catch handler won't work. https://jakearchibald.com/2017/await-vs-return-vs-return-awa...
Re:If Not SPAs, What? by azhu on Thursday October 29, 2020 @04:07PM (#24935090)
Semi funny that this exchange is kinda like proof of why JS catches the hate it does.
Re:If Not SPAs, What? by CameronNemo on Wednesday October 28, 2020 @11:12PM (#24926767)
Do you have evidence?

Vue and Svelte, IIRC, were authored by designers. Not C or Java programmers. Perhaps React has a different history.

Re:If Not SPAs, What? by skoskie on Wednesday October 28, 2020 @11:29PM (#24926879)
> I have a theory

Pretty sure they were just sharing thoughts.

Re:If Not SPAs, What? by winrid on Thursday October 29, 2020 @12:02AM (#24927060)
Vue is influenced by AngularJS, designed by a Java dev.
Re:If Not SPAs, What? by wvenable on Wednesday October 28, 2020 @11:57PM (#24927035)
Except that desktop development is actually easier, with fewer tools and frameworks, than the spaghetti that is modern web development.
Re:If Not SPAs, What? by winrid on Wednesday October 28, 2020 @11:50PM (#24926998)
AngularJS was designed by a Java guy, so the argument has a little merit.

But honestly, this is because mature backend frameworks can be REALLY nice.