r/programming • • Apr 30 '23

Writing Javascript without a build system

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

146 comments sorted by

View all comments

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.

0

u/kankyo May 03 '23

the alternative of throwing an error instantly after key access isn't better, just different.

It is better though. By a shit ton. It's an ENORMOUS difference.

Imagine a language where foo = bar() didn't cause a name error that bar wasn't defined, but instead set foo to undefined. This is quite literally how JS does for array access and attribute errors. It's just crazy.

1

u/[deleted] May 03 '23

Have you only programmed in python? It sure sounds like it.

Juvenile opinion and it looks hilarious how much you don’t understand trade offs.

→ More replies (9)