• theneverfox@pawb.social
      link
      fedilink
      English
      arrow-up
      0
      ·
      10 months ago

      Fun fact I learned today - you know how when there’s a compound conditional, the interpreter stops once the result is known? (Eg, if the left side of an and is false, it’s false so it doesn’t bother checking the second condition)

      Apparently, visual basic doesn’t do this thing every other language I know of does… It might be a debug only thing for the convenience of the depreciated ide I’m forced to use, but I did a null check && called a function on it if it’s not null, and it blew up

      I pride myself on my ability to change to a new programming language and make progress on day one, but vb is truly the most disgusting POS language I’ve ever seen. From syntax to jarring inconsistencies in language design, it’s just gross

      • noli@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        10 months ago
        1. That’s behaviour that’s just part of language design. If you rely on it you should probably check how the language you’re using handles it.

        2. relying on that behaviour sounds a lot like “clever” (read unnecessarily unreadable) code

    • mrkite@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      10 months ago

      Known to cause heisenbugs. They’re bugs that disappear when you try to measure them with a debugger or a printf.