Hacker News new | past | comments | ask | show | jobs | submit login

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.




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?


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)


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...


Semi funny that this exchange is kinda like proof of why JS catches the hate it does.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: