this post was submitted on 31 Jul 2024
716 points (99.4% liked)

Programmer Humor

19623 readers
98 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] EnderMB 191 points 3 months ago (6 children)

I've honestly never understood why someone at Google or Mozilla hasn't decided to write a JavaScript Standard Library.

I'm not opposed to NPM, because dumb shit like this happens everywhere. If such a package is used millions of times a day, perhaps it would make sense to standardise it and have it as part of the fucking browser or node runtime...

[–] [email protected] 50 points 3 months ago (1 children)

I’ve honestly never understood why someone at Google or Mozilla hasn’t decided to write a JavaScript Standard Library.

[–] [email protected] 4 points 3 months ago (1 children)

This picture honestly looks more like C++ than JS, and before you yell at me, JS doesn't have any standards let alone competing standards so ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

[–] stetech 1 points 2 months ago (1 children)

JS doesn't have any standards

ECMAScript would like to have a word with you.

If however by “doesn’t have any standards” you meant it’s willing to sink to new low grounds every day, you would be correct.

[–] [email protected] 2 points 2 months ago

The latter, and the underutilization of the fact that the standard library exists, and consequently the existence of so many micro dependencies.

[–] [email protected] 44 points 3 months ago* (last edited 3 months ago)

someone at Google or Mozilla hasn't decided to write a JavaScript Standard Library.

Core APIs (including data types like strings, collection types like Map, Set, and arrays), Browser, and DOM APIs are pretty good these days. Much better than they used to be, with more features and consistent behaviour across all major browsers. It's uncommon to need browser-specific hacks for those any more, except sometimes in Safari which acts weird at times.

The main issue is server-side, and neither Google nor Mozilla have a big interest in server side JS. Google mostly uses Python and Java for their server-side code, and Mozilla mostly uses Rust.

Having said that, there's definitely some improvements that could be made in client-side JS too.

[–] [email protected] 28 points 3 months ago (2 children)

There's a js runtime called bun that is 90-something% feature equivalent to node and also has built in alternatives to many packages like express and bcrypt. I haven't used it myself so I can't speak to its quality but it's always nice to see a little competition

[–] drmoose 19 points 3 months ago (2 children)

So is Deno! You can easily import npm: and node: packages and run typescript without transpiling. With Bun and Deno there's no reason to use Node tbh.

[–] sfxrlz 5 points 3 months ago (1 children)

For starting new projects i absolut agree. At work we have a legacy react app that just will not run on bun and for deno we would probably have to rewrite some stuff.

[–] drmoose 5 points 3 months ago (1 children)

I've updated some legacy nodejs to Deno recently and it's actually not bad! If you're using serverless Denoflare is super convenient and DTN is a tool for building Deno to NPM (both esm and commonjs) so you can have easy backwards compatibility if needed, it even shims all of the Deno standard lib.

It's really impressive what Deno and Bun people have done - for the first time I actually somewhat enjoy server side JS!

[–] sfxrlz 3 points 3 months ago

That sounds neat. For our nodejs server this could be done without too much effort. Will keep that in mind, thanks. But I also have to check for the cra app we’re having a lot of issues with.

[–] [email protected] 2 points 3 months ago

node now supports stripping types, which is good enough for one-off TS snippet.
(available only in nightly for now)

[–] [email protected] 3 points 3 months ago

Bun is used by us in production, in dev, everywhere. It's great. We don't even use (p)npm to build js packages on our docker images for apps anymore.

[–] [email protected] 26 points 3 months ago (3 children)

I wish they would replace JavaScript with something that was made for what it's used for. JavaScript should have died years ago.

[–] hswolf 12 points 3 months ago (1 children)

Sometimes it's hard to detach It, specially dealing with web dev.

The browser expects JS, since JS was made for the browser, so you make a front in JS. But now you need a back, and hey, you already have all models and repos in JS, might as well make the back with JS.

It's a vicious cycle. Honestly, JS is fine for either if you are component enough (ie. not using stuff like "is-number"), don't get the hate on It.

[–] [email protected] 3 points 3 months ago (1 children)

No, JS is for scripts, it should have never been a whole framework for a frontend. But we can't get away from it now, because it's the only thing we have for browsers.

[–] JaddedFauceet 5 points 3 months ago (2 children)

What do you want to use for frontend framework then?

python, ruby, java, C? Invent a new language?

you will see me screaming "X is for Y, it should have never been a whole framework for a frontend"

[–] [email protected] 5 points 3 months ago (1 children)

Anything, as long as it's not a bunch of scripts which form a framework after you downloaded a terabyte of shady dependencies.

[–] JaddedFauceet 2 points 3 months ago

React it is then 😄. It only has 2 dependencies:

- react
    - loose-envify
        - js-tokens

https://www.npmjs.com/package/react?activeTab=dependencies

[–] [email protected] 4 points 3 months ago

Static? I mean for most of the web it honestly seems like the move. HTMX?

[–] PmMeFrogMemes 12 points 3 months ago

I'm still waiting for webassembly to take off

[–] TechNerdWizard42 11 points 3 months ago (1 children)
[–] [email protected] 4 points 3 months ago (1 children)
[–] [email protected] 3 points 3 months ago

Java applets 🌈

[–] [email protected] 10 points 3 months ago

Support for int64s out of the box and without jumping through hoops would be nice.

[–] [email protected] 2 points 3 months ago

core-js is exactly that, but it focuses on implementing baseline features that can be polyfilled.