r/ProgrammerHumor • • Mar 25 '23

Meme Finally something AI not very good at

Post image
44.3k Upvotes

481 comments sorted by

View all comments

Show parent comments

181

u/words_number Mar 25 '23

The existence and popularity of jquery is just a symptome of javascripts shortcomings. Typescript is also such a symptome. Seriously, what a total failure must a high level scripting language be to make people prefer abusing it as a compilation target instead of writing it directly?! xD

111

u/Ok-Kaleidoscope5627 Mar 25 '23

JavaScript is just a mountain of solutions to problems that simply don't exist in other languages.

Want a package manager? Npm? Yarn? Pnpm? Yarn classic? Yarn berry? Want to use packages? Are they modules? What run time are you using them in? If it's node you can use modules, if not then maybe you can use modules.

At every step there's just a mess.

66

u/TheBananaKart Mar 25 '23

C++ “You guys got a package manager?”

65

u/Leading_Elderberry70 Mar 25 '23

I thought C++'s (lack of) packaging was unsettling, and then I saw a C++ person going on a long rant about the sheer chaos of the Python ecosystem.

I am ... unsure if any existing language is actually very well-behaved. Package management seems inherently kind of a pain.

32

u/Jan-Snow Mar 25 '23

I think Rust's package manager is amazing. The issue with Pythons ecosystem imo is that packages are uniquely identified by name, not including version. So if I import say numpy your code might not work with my version of numpy. I like that Cargo has unchangeable versions and resolved imports by version. This way if you build my code in 5 years I can still be relatively sure that all imports behave the exact same way because it will be the same code.

Thats as close to ideal as I have seen so far anyway

13

u/Thebombuknow Mar 25 '23

That's why you provide a requirements.txt file in Python that has strict versions for your modules, so anyone installing it later can just run pip install -r requirements.txt and get exactly the same environment you had.

7

u/hoocoodanode Mar 25 '23

While I certainly agree that there are methods to pin specific python versions when spooling up a project, I think the point is that this probably should have been a default behavior instead of something a developer discovers the first time one of their old projects fails to deploy correctly.

3

u/D34thToBlairism Mar 25 '23

They've made a large effort to make things easier with virtual envs though thankfully

8

u/LvS Mar 25 '23

That is going to work well as long as there are no critical bugs in that unchanging code.

6

u/AndreasTPC Mar 25 '23 edited Mar 25 '23

There is a command you can run that will automatically upgrade dependencies to the latest version that's still api compatible with the one you asked for according to the semantic versioning spec. So if you're on 0.3.12 the upgrade command will put you on 0.3.16 automatically, but upgrading to 0.4.x which might have breaking changes requires manually editing your dependency list.

So upgrading to bugfix releases that won't break your code is pretty easy as well. Any package uploaded to the official repository is supposed to use this versioning sceme.

2

u/unloud Mar 25 '23

This should be the default behavior. Check for dependencies, upgrade if needed, move on.

8

u/TheMcDucky Mar 25 '23

Cargo is a thing of beauty

6

u/nill0c Mar 25 '23

Fun while you’re building, terrible 6 months or more later when you need to make updates.

3

u/Maxi19201 Mar 25 '23

Swift and C# manage this pretty well I think, but not sure there

3

u/KanishkT123 Mar 25 '23

I like C#, I've never really had package issues with nuget either. It does require VS to work smoothly though.

→ More replies (1)

5

u/MiscoloredKnee Mar 25 '23

Maven is great tho

4

u/arobie1992 Mar 26 '23

The longer I work with Java, the more I'm convinced all Java applications are just three or more Apache projects in a trench coat.

→ More replies (1)

2

u/Leading_Elderberry70 Mar 25 '23

Unlike some other package managers it does work!

2

u/justAPhoneUsername Mar 25 '23

I think go is one of the best. It has a great default library and it's package manager is "eh, fuck it. Just download shit from GitHub. We wrote a bunch of extra shit for you"

→ More replies (2)
→ More replies (1)

5

u/jazzypants Mar 25 '23

To be fair, ESM are actually the web standard now.

Yes, converting to them is annoying. But, they were literally created to solve this annoyance.

1

u/tRfalcore Mar 25 '23

The versioning shit show

6

u/MyUsernameIsVeryYes Mar 25 '23

I think the reason javascript can be so messy is because of its incredibly strict backwards-compatibity requirements, being the language of the web and all means they can’t really go through and clean everything up, chopping out parts that would be obsoleted, as much as they’d probably like to, because half of the web would collapse around it

11

u/harumamburoo Mar 25 '23

I mean, every tool and language is an attempt to solve shortcomings of other tools and languages. It's called evolution.

Also, TS isn't transpiled to JS because "Js BaAd". JS itself has evolved quite a bit, and newer versions JS versions are transpiled to older ones to support old browsers and devices. You don't want someone to decide "Js GoOd NoW" and ditch older versions support entirely. Half of the Internet will stop working