6 ms·
I used Typescript on the front end a couple of years ago but not on the back end yet. I imagine that it would be better than es6 since there would be some typin
by santoriv 10y ago
I used Typescript on the front end a couple of years ago but not on the back end yet. I imagine that it would be better than es6 since there would be some typing. I'd still rather go with C# and not have to deal with callback/promise land.
- jayajay 10y agoES6 and ES7 fixes everything here except strict typing, by the way.
- Arnavion 10y agoasync-await is in neither of those, though TS does support it and downlevels it to ES5/ES6.
- nrjdhsbsid 10y agoAlso still no multithreading, which causes callback hell in the first place
- jayajay 10y agoLike others have said, callback hell is fixed with async/await, yield/generators, and even lightweight libraries like fibers and promises. Personally, I dislike promises, and I don't use them at all. That said, you have plenty of other choices when it comes to style. The single-threaded nature of node.js was very intentional and was thought to be a better design choice for a certain class of applications (IO focused, not computation focused) like routers, web servers, and other networked applications.
- nrjdhsbsid 10y agoSingle threading was not intentional. It's because they used js, now they're trying to sell it as a feature. They've tried to implement threading several times but it's a huge change to the V8 engine and js isn't designed for it. Promises/async were needed to make the language usable because it's stuck on a single thread. The normal solution is to just use multiple threads and people have been doing g that for many years in other languages
- jayajay 10y ago"its because they used js" But, this was intentional. As for them implementing threading, I am not sure about the history here. Was it like: "We used JS and knew we were going to have a ST environment, but because people wanted MT, we tried..." Or, was it more like: "Let's use js and we'll of course need MT like everything else... oh wait... nvm."?
- Matthias247 10y agoI second that. JS is singlethreaded by intention, and IMHO it's ok that way and the reason why the ecosystem mostly works and async libraries can be reasoned about. There are JS implementations (like Nashorn on JVM) which are multithreaded, and imho they would be a much poorer choice. Once you have callbacks and multithreading in a single system there are dozens of things you need to care about (from which thread will callback be fired, how to synchronize that with the remaining logic, ...) and the complexity grows immensely. I think that's exactly the scenario that the JS inventors wanted to circumvent.
- geon 10y agoTs is great on the backend. And if it gives you only "some typing", you are doing it wrong. With noexplicitany and strictnullchecks, you can get really nice, typed code. Even stringly typed code can be typed now, with keyof.
- deleted 10y ago[deleted]