• Fushuan [he/him]@lemm.ee
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    It makes perfect sense if the Lang objective is to fail as little as possible. It picks the left side object, checks if the operand is a valid operand of the type. If it is, it casts the right variable into that type and perform the operand. If it isn’t, it reverses operand positions and tries again.

    The issue here is more the fact that + is used both as addition and as concatenation with different data types. Well, not an issue, just some people will complain.

    • grue@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 days ago

      Computing a nonsensical result is itself a failure. Continuing to run while avoiding giving an error in that case accomplishes nothing but to make the program harder to debug.