• Fleur_@aussie.zone
    link
    fedilink
    arrow-up
    1
    ·
    3 hours ago

    If a glass is half full on a table but there are no optimists to see it, is it half empty?

    • Klear@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 hours ago

      You have an infinitely large glass of water that is full, but you need to store extra infinite water in it. Will your optimism help you do this safely?

  • Phoenixz@lemmy.ca
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    22 hours ago

    Meanwhile JavaScript: 1+“2” = “12”

    Just had fun with that yesterday

    • dual_sport_dork 🐧🗡️@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      2
      ·
      edit-2
      22 hours ago

      You can wind up in the same trap in VB/VBA as well. It baffles me that in this current century there are still languages where text concatenation symbols and mathematical operators are the same character.

      It’s even worse in the case of VB because you can also use & explicitly to concatenate strings, whereas + can be either a mathematical operator or a string concatenator depending on context and the types of variables you’ve put it between, which VB may or may not decide to cast into strings depending on an arcane set of conditions that nobody understands or remembers. So the solution was right there all along, i.e. just make & the only concatenator and reserve + for math only. But that would be too much like right.

      • Phoenixz@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        15 hours ago

        PHP uses . which works perfectly fine, I’ve never encountered this nonsense before

        • dual_sport_dork 🐧🗡️@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          15 hours ago

          Yes, and PHP can even implicitly (or explicitly!) cast variables between different types. Dot (.) is for strings and + is for math. It’s one of the few things about PHP that makes sense.

      • SpaceNoodle@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        20 hours ago

        There’s nothing wrong with overloading an operator for other classes; the problem is the unexpected typecasting.

        Python, for example, will allow you to “add” strings to concatenate, but will throw a type error if you attempt to add a string to an integer.

  • hOrni@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    21 hours ago

    Pessimist: The glass is half empty.

    Optimist: The glass is half full.

    Realist: Guys, I think this is piss.

    • Creat@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      17 hours ago

      Depends on your date format. For it to be a problem to begin with, you need to use a date format with “/” as the separator. If it’s 1st of Jan or Feb 1st then depends on the order.

      And of course you need to enter an actual fraction, instead of like 0.5. This also narrows down the locations where this is an issue considerably. I think it’s mostly north America where fractions are more commonly used instead of decimals die to the imperial system, but there might be other places where it’s common, too, and I just don’t know about it.