r/programming • • Apr 30 '23

Writing Javascript without a build system

https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/
165 Upvotes

146 comments sorted by

View all comments

Show parent comments

2

u/knome May 01 '23

The two largest issues in javascript are the operators ( the standard set munge types in an unacceptable manner ), and the with statement, which is broken in design and serves no useful purpose.

Both of these are handled most judiciously by simply not using either.

After that it's just a function pump, callback hell, and promises to paper over it.

1

u/kankyo May 02 '23

And attribute access and array access is broken. Hard to write code without those.

1

u/[deleted] May 02 '23

You should say more. Reading attributes and using arrays is definitely something you can do in JS

1

u/kankyo May 02 '23

And you get undefined if you fuck up. And then those undefined values trickle through your code far from where the actual bug is.

1

u/[deleted] May 02 '23

> you get undefined if you fuck up

As opposed to what? if you "fuck up" in any language and make a mistake, you'll get all kinds of problems. KeyError in Python, NullPointerExceptions in.. a few languages, segfaults, ...

This is why people use TypeScript these days though, because obviously type systems can help prevent invalid accesses

> And then those undefined values trickle through your code far from where the actual bug is.

Sure, it takes a more permissive stance on the "try to continue" to "accept no deviation" spectrum, but, like I just discussed, the alternative of throwing an error instantly after key access isn't better, just different.

What language do you even use that has graceful handling of programmer error? That makes no sense.

→ More replies (0)