4 ms·
I wish the standard language in the browser was statically typed, immutable data, and purely functional. Not what we have, which is a language that is not only
by user3939382 4y ago
I wish the standard language in the browser was statically typed, immutable data, and purely functional. Not what we have, which is a language that is not only OO, but a crazy version of it, that "can" also be used quasi-functionally.
There's a lot more to developing large projects than your own code. What about the ecosystem? What about everyone else's code? JS IMHO is just a complete mess. That's not at all to belittle the size of the problems it is tasked with solving, which are hard and complex. The difficulty is precisely why the right tool for the job is something that really insists on some level of correctness, in the vein of what rust tries to do at the systems level.
This is all IMHO and there's a lot of room for different opinions here, but I'm guessing we have a consensus, even among JS's biggest advocates, that it can't be described as "insisting on correctness".
Unfortunately the more relevant follow-up question might be: okay it's the wrong tool for the job, so what? It's what we have.
- eddsh1994 4y agoCan it really be called the wrong tool when so many huge businesses and essentially the entire globe are powered by it? It’s certainly worked imo
- OkayPhysicist 4y agoI'd bet good money you could go back in time and swap out JS with just about any relatively high-level language (maybe the original Scheme plan, maybe Java, literally anything with managed memory) and that language would enjoy JavaScript's popularity today. JavaScript's ubiquity has everything to do with its monopoly in the browser, and nothing to do with any specific features of the language.
- hombre_fatal 4y agoThat was once true. But Javascript has grown into a language that makes some solid and unique trade-offs including its simple single-threaded concurrency, modern language features, async-everything, first-class Promise, and Typescript. "Javascript sucks and people only use it because they have to" is both wrong and boring. We, as a community, have to stop trotting out this tired comment any time a submission has the word Javascript in it.
- mixedCase 4y agoTypeScript is not a feature of JavaScript, and the ability to have single-threaded IO event loops is far, far, far from something modern, unique or remarkable about a language, the fact that it's limited to single-threads actually makes it something you really do not want to bring up as a "pro" but rather as "it's something you'll have to keep in mind".
- hombre_fatal 4y agoTypescript is certainly a feature of the Javascript ecosystem. Typescript's success and maturity easily puts it ahead of other dynamically-typed languages that tried to bolt on static typing support. Not including TS with JS just seems like a pointless "well actually" quibble. Single-threaded + async-everything is a unique and powerful feature of Javascript. You might not like it every time, but it's useful most of the time. Most other languages make it easy to write single-threaded but blocking code where you need to reach for an extra solution to write async code, and not everyone needs to even use the same solution, and it doesn't necessarily work with the default blocking ecosystem. We take that for granted in Javascript. Once again, this is a very tired thread. Sometimes you just have to admit there are trade-offs and that you aren't going to have a taste for every decision on every trade-off every time. And that's okay. Nobody in this thread is even interacting with TFA.
- actionfromafar 4y agoIt’s a feature which follows from how web browsers work. I agree with above comments that you could have taken any language. But you have a point, making async mandatory is a powerful thing. This could have been done to any language tho, Java, TCL, Scheme, whatever.
- blacksqr 4y agoTcl already has built-in event loop and async programming features.
- adamnemecek 4y agoMight be despite of it.
- tikhonj 4y agoThere's a pretty big gap between "this tool is so bad it's impossible to use" and "this tool is quite bad but determined people can still make it work"—my experience is that the latter is totally sufficient for a tool to go mainstream, but it can still be fair to call it the wrong tool :P
- sodapopcan 4y ago"Essentially the entire globe" is way off. In the web world, yes, and some niche people doing stuff with JS because they can, maybe. I don't think you find much, if any, of it in cars, planes, telecom, robotics and other areas of computing. Correct me if I'm wrong, though. And just because something is ubiquitous doesn't mean there doesn't exist anything better.
- tshaddox 4y agoCan any situation that exists in the world be bad? Yes, indeed. If anything, the ubiquity of JavaScript makes its shortcomings a worse problem than if JavaScript weren't so widespread.
- joshspankit 4y agoYou don’t need excellence to have a profitable company, and in fact once you get to about 80% of excellence you make less profit the higher you go. Businesses/industries being huge does not indicate whether a tool/method/approach is high-quality.
- dahfizz 4y agoIt powers the web, because there are no other options. If JS was good, people would use it for other things. Terminal apps, trading algos, operating systems, compilers, embedded, databases, etc etc. JS is never the best tool for the job. But sometimes, it's the only one.
- kamma4434 4y agoSure. Multi-megabyte download that display a spinner while fetching data to display a web page. But hey, billions of flies cannot be wrong
- markeibes 4y agoPlease use PureScript with us and lead a happy life
- quaunaut 4y agoPureScript has what I'd call some stark issues. 1. Its maintenance/activity appear sporadic at best. 2. It's inscrutable. Whenever I've had issues, I don't have any idea even how to approach solving them. Half the time they reference in-depth mathematical terms that just are not relevant to anyone who isn't implementing the language 95% of the time. 3. The tooling often just... doesn't work. I'll go to run a commend given in the official tutorial, and it fails in a way that is just beyond me, as an experienced engineer. TBH, I'd really love to use it. I've been finding myself using `fp-ts` on many of my projects for just such a reason, and have even set up `unplugin-auto-import` to automatically detect and import those modules, so it's like I have more in my stdlib. I've even thought of making a true language out of these primitives.
- dsffghfghfghfgh 4y agoOpposite experience with Purescript. I've never had an issue that hasn't been resolved on the Purescript discourse within 24 hours of posting. The core team in my experience are all very dedicated and helpful.
- asddubs 4y agoI think its functional parts are some of its best qualities. Even before we got let and const, function scope was a really nice treat that many many other languages from around the same time got wrong(er) what I really detest about javascript is its inability to say no to the programmer (most dominantly typing woes), and how incredibly late it got some super basic features for code organization. private class members (in a way that isn't syntactically insane) got added to the language figuratively two days ago. what the hell?
- srcreigh 4y agoWhen JS was made, Andreesen wanted to implement Scheme but his boss asked him to make it look like Java. Is it crazy? yeah. But it’s not quasi functional.
- adamrezich 4y ago> This is all IMHO and there's a lot of room for different opinions here, but I'm guessing we have a consensus, even among JS's biggest advocates, that it can't be described as "insisting on correctness". this was pretty much the result of the XHTML debacle as well, and I know the reasons why that went down the way it did, but it's kind of weird to me that We Just Can't Have Enforced Correctness In The Browser.
- eckza 4y agoYou can learn Elm. All twelve of us will help you. It's far from being "the standard language for the browser", but the browser doesn't know that.