ok so i know javascript is generally hated among people who write in Real Languages, but

i have a confession

i actually kinda like JS. if you leave out inheritance, program in a pseudo-functional style, and don't get distracted by the 500 new frontend frameworks and build tools that come out every week, you can be super productive in JS.

i think JS gets a lot of hate because it kinda sucked for a long time, but it sucks a lot less now.

i know a bit of haskell, a tiny bit each of clojure and racket, shell, some python, a bit of ruby, enough C to cause problems, and i've also done some php and c#, and of all of those languages, i like haskell, clojure, javascript, and python the most, in that order.

but i have no real-world use case for haskell, clojure's dependency on the jvm is a PITA, and python is really well-designed but the ecosystem is confusing (python 3 came out TEN YEARS AGO and i still never know which version of python to use in any given project!).

@zacanger It did a lot of good, IMO it played a significant role in popularizing first-party async features in languages (and higher-level parallelism abstractions than plain threads).

(but I still don't really like JS because of a lot of the fundamental design decisions are frankly asinine)

@elomatreb you're right, teaching people about monads through promises is actually a lot easier than teaching people about monads through math, for example

@zacanger IMO the best monad example is Maybe/Option, but that has so few applications in scripting languages sadly

@elomatreb i've seen libraries that go all out with category theory in JS and have a Maybe monad, but you're right, i can never think of good places to work that into js applications

@zacanger I find myself wanting a Option type in Ruby in some circumstances, e.g. to build a combination of a map and a filter operation (Rust's iterators use Options to build filter_map for that, which is really nice)

@zacanger One of the main points of the book "You don't know JS" is that people used Javascript in ways it wasn't intended to be used and nobody know how to use it anyway, just some of the many frameworks and build tools.

@besserwisser i've never read that, but i probably should at some point, i know that's a very popular series.

a lot of the legacy frontend code i run into is like that: "here's a library, copy and paste this stuff, don't bother learning the language, just copy-paste this example"

@zacanger I don't really do much Javascript code (or code in general right now) but I really liked reading it

@zacanger I don't hate JS because of its feature set or its 666 different frameworks that exist for other reason than that HTTP POST just isn't good enough any longer.

I hate JS because it enables adtech and allows website developers to tamper with my browser's functionality. All third-party JavaScript is malware and should be blocked.

@starbreaker i agree! javascript has made it easy to people to make stuff that never should've been made. that would've happened with any client-side language though -- native mobile apps, for example, also have ads and tracking, just in java/kotlin and swift/obj-c instead of JS.

@zacanger True, but I must actively choose to install those. Webshit developers assume that my simply navigating to a given URL constitutes I permission to run any code they choose to serve up.

@starbreaker yeah true! though it's not usually the webshit developers (i develop a webshit for a living!), it's the marketing people the webshit developers work with :\

@zacanger IMO, "Blame marketing" is the new "I was just following orders". Developers need to take a stand. We have the knowledge, and therefore the responsibility.

There is nothing wrong with Javascript. It has issues like any other language. However some people find it fashionable to dislike it. Generally speaking, those people don't know Javascript. XD

@zacanger Well, as you said it’s quite fine now, specially for a scripting language.

But the thing is:
• Almost no one is using it as a script language or without a huge library/framework.
• I also would also say that JavaScript should be optional/opt-in and not needed when it can be done with simple HTML/CSS.

And you might put me in the JS-hater category but I just dislike/hate uncute web. (as in )

@lanodan i kind of agree, though i don't think there's anything wrong with using libraries/frameworks, because folks who actively avoid them seem to end up accidentally writing their own.

i do agree that the web can mostly be simpler, but at some point you're just trading client-side rendering for server-side rendering. for applications, all the complexity has to live somewhere. it's nice to say "i don't want my browser doing the work, your server should do the work" but that's not always easy

@zacanger I don’t think we should avoid libraries (I think we should avoid frameworks but for a different reason), they are made to avoid duplicating code, but if you end up importing them for basically nothing you end up having duplicate ~code that is useless.
And I think there should be a work balance between the server and the browser, but you should not require stuff on the browser unless you actually need it.

@lanodan yeah 100% agreed! some tools (webpack, rollup) help with the shipping-unused-code problem, but i worry that people will get used to that and forget how to keep their dependencies small and intentional

@zacanger Yup, and webpack takes a lot of time to build your stuff, it’s basically the same as compiling for me, except that the optimisation and stuff like ccache aren’t much there yet.

@zacanger it is my favorite. probably doesn’t hurt that it was my first. i relate anything new to the JS-based rosetta stone in my brain.

@steelman @angristan
That's one of those "just don't do that and you'll be fine" things. There's no good reason to ever use `==`, the same way there's no good reason to ever use `eval` or `with`.

Sign in to participate in the conversation

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!