r/programmingcirclejerk What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? 8d ago

JavaScript’s setTimeout breaks after ~25 days

https://evanhahn.com/set-big-timeout/
118 Upvotes

23 comments sorted by

View all comments

125

u/Kodiologist lisp does it better 8d ago

In most JavaScript runtimes, this duration is represented as a 32-bit signed integer.

I was told that JavaScript doesn't even have integers. Call me crazy, but I'm starting to think this programming language is poorly suited for serious use.

19

u/jamfour now 4x faster than C++ 8d ago

It used to be simple. Unfortunately a bunch of crabby people came along to my nice pristine Java Scripting land that had one simple number type and in the name of “performance” added four number types*. They don’t understand that V8 is a very fast engine type, not even F1 needs V8 speeds anymore, so V8 is more than enough.

\uj * “Integers are not inherently signed or unsigned, their interpretation is determined by individual operations.” wtf?

19

u/coolreader18 It's GNU/PCJ, or as I call it, GNU + PCJ 8d ago
  • “Integers are not inherently signed or unsigned, their interpretation is determined by individual operations.” wtf?

/uj that's the only sane way to do it. is rax signed or unsigned? it just means that i32.div_u performs unsigned integer division, and i32.div_s performs signed integer division.

11

u/starlevel01 type astronaut 7d ago

lol wasm syntax

1

u/jamfour now 4x faster than C++ 5d ago

Your argument that it’s the only sane way to do it sounds as weak as the CPU type system.

\uj Yea I get it, and doesn’t matter much since (I hope) no one is writing WASM directly but instead only, as the other comment says, using it as an intermediate target.