this post was submitted on 06 Feb 2024
110 points (94.4% liked)

Programming

16976 readers
205 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 7 months ago (1 children)

That's what I hate about javascript, it doesn't warm you about undefined behavior, it just throws.

I used to not really care about that, but after learning C and Rust, damm, I wish there where result types everywhere

[–] [email protected] 9 points 7 months ago* (last edited 7 months ago) (1 children)

Some small nits to fix:

  1. C has it's own undefined behavior.

  2. JS has confusing behavior, not undefined behavior. Its specs are well defined and backwards compatible to a fault, making some things unintuitive and harder to learn if you don't learn the history of the language.

  3. Problems with both should be avoided by learning and using standard practices. (Don't pretend C is object oriented, always use === instead of == in js, etc...)


In complete agreement:

  1. Result types are awesome, all future languages should be designed around them.
[–] [email protected] 2 points 7 months ago

thank you very much.

By undefined I meant the usage of undefined in the language, however you phrased it way better :)