• noli
    link
    fedilink
    arrow-up
    2
    ·
    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

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

      Are you serious? It’s one of the most basic and common if statements that exist.

      If( foo != null && foo.isBar() )

      That’s what we’re talking about. Looking before you leap.

      I take issue with the whole “too clever” argument fundamentally (for a number of reasons), but this isn’t some fancy quality of life feature. This is as simple as it gets

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

          Scroll on down to the first common example there champ.

          If you really think that’s being “too clever” I don’t know what to tell you… A big reason I think that argument is bullshit is because writing simple code isn’t a goal (what does that even mean?) - readability is a big one, and breaking up every part of every conditional would just lead to unreadable spaghetti

          Also, take a look at the languages being discussed. This is a long settled question - every language I’ve ever used has this.

          Including VB, I found out it uses AndAlso…so gross

          • noli
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            10 months ago
            1. several languages that are still in use have eager evaluation.

            2. I’m a dumb programmer. The more I need to keep implicit behaviour in mind, the higher the probability I’m writing bugs. Short circuit evaluation is an optimization technique IMO and shouldn’t be relied upon for control flow.

            3. The aggressive tone you’re using is completely unnecessary and immature, so I’ll refrain from responding any further. Have a nice day.

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

              You’re the one who started this by criticizing my knowledge and my coding practices, in response to me sharing one very specific example of why I believe VB is a bad language

              I held off because I thought you must’ve misread it and we’d laugh and maybe talk about language design… But no, you confirmed you just came at me with a bad take extremely dismissively

              If you want respect, try showing it.