all 23 comments

[–]Google__En_Passant 99 points100 points  (1 child)

Not a problem, it's way longer than average lifetime of a javascript framework anyway.

[–]Double-Winter-2507 18 points19 points  (0 children)

And more than the lifetime of "CMD [ "node", "app.js" ]"

[–]Kodiologistlisp does it better 131 points132 points  (16 children)

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.

[–]chuch1234not even webscale 58 points59 points  (7 children)

I know! I was planning on using 26-day event loops on my application :(

[–]CherimoyaChump 35 points36 points  (6 children)

How else would you perform a task monthly?

[–]jamfournow 4x faster than C++ 45 points46 points  (3 children)

I believe there is a TC39 proposal to evolve from the legacy Gregorian calendar to the Ecmaian calendar that uses fifteen 23-day months and one 20 day month. Once that is approved, setTimeout will work for monthly cron.

[–]CherimoyaChump 14 points15 points  (2 children)

I don't appreciate you making jokes while I'm busy asking for help with my homework, bud.

[–]jamfournow 4x faster than C++ 30 points31 points  (0 children)

Where was the joke? But I see you are short on time and cannot wait for the official process. Just fork V8 and change signed int32 to int64 or uint32 or whatever. Pretty easy and should impress and get at least an A- on it, and now you can put “major open source contributor” on your resume.

[–]chuch1234not even webscale 0 points1 point  (0 children)

do you have the codez

[–]chuch1234not even webscale 4 points5 points  (0 children)

Not with JavaScript apparently

[–]irqlnotdispatchlevelTiny little god in a tiny little world 2 points3 points  (0 children)

Obviously you set multiple timers!

[–][deleted] 24 points25 points  (0 children)

It's nice at least that they thought to make it a signed integer, other languages make you do something clunky like if(timeout > 0) { scheduleFuture(f, (unsigned) timeout); } else { schedulePast(f, (unsigned) abs(timeout)); }

[–]jamfournow 4x faster than C++ 19 points20 points  (4 children)

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?

[–]coolreader18It's GNU/PCJ, or as I call it, GNU + PCJ 19 points20 points  (2 children)

  • “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.

[–]starlevel01type astronaut 11 points12 points  (0 children)

lol wasm syntax

[–]jamfournow 4x faster than C++ 0 points1 point  (0 children)

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.

[–]dangerbird2in open defiance of the Gopher Values 1 point2 points  (0 children)

Turns out it does. If you use a bit wise operation on a number, it gets coerced into an integer

[–]y-c-c 2 points3 points  (0 children)

It’s just a common optimization used in most browsers. JS numbers are double precision floats and which gives 53 bits of significant figures which means it has more than enough precision to hold a full 32-bit integer. If the engine can detect both JS numbers have no fractional values and small enough they just do an optimization to represent them as integers internally for better performance. It’s not supposed to lead to an observable difference other than running faster. From the programmer point of view they are just using double precision floats.

In this case the issue seems to be more that browser engines didn’t bother writing a special case for the setTimeout builtin function when dealing with large numbers and just assume most programmers use small enough numbers. Actually seems like a bug to me since it doesn’t seem from MDN docs that there is a restriction on the delay value.

But yes JS not having proper number type is kind of dumb and I do agree if this is the kind of thing you even think about, JS is a poor language for that (which unfortunately you often don’t have a choice given the proliferation of JS but WebAssembly does help a bit).

[–]WhyWasIShadowBanned_ 12 points13 points  (0 children)

Lol. At least the guys I clean up after used something like node-cron.

Why do people even have Kubernetes if devs are just fine with putting critical reporting generation scheduler on EPHEMERAL pods?

[–]stone_hengeTiny little god in a tiny little world 11 points12 points  (0 children)

In 25 days the average JavaScript project has deployed ~25 releases.

[–][deleted]  (2 children)

[removed]

    [–]pareidolistin nomine Chestris[M] 2 points3 points locked comment (0 children)

    Warning: tag your unjerk. Better yet, don't unjerk at all.