• bleistift2@feddit.de
    link
    fedilink
    English
    arrow-up
    22
    arrow-down
    1
    ·
    1 year ago

    That’s not even close to solving the halting problem. FF doesn’t check if the program has been in its current state before. It literally just checks if 10 seconds have passed without JS emptying its event loop.

    • jeff 👨‍💻@programming.dev
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      1
      ·
      1 year ago

      Right. There is no solution to the halting problem, that’s been proven. But you just showed you can very easily create a way of practically solving it. Just waiting for 10 seconds does it. That will catch every infinite loop while also having some false positives. And that will be fine in most applications.

      My point is that even if a solution to the halting problem is impossible, there is often a very possible solution that will get you close enough for a real world scenario. And there are definitely more sophisticated methods of catching non-halting programs with fewer false positives.

      • xigoi@lemmy.sdf.org
        link
        fedilink
        arrow-up
        4
        arrow-down
        2
        ·
        1 year ago

        And that will be fine in most applications.

        Have you never written a useful program that took more than 10 seconds to complete?

        • bleistift2@feddit.de
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          I fully agree with your sentiment. But just in case: If you’re blocking the main thread of a browser for seconds at a time, you should look into that.