• dragnucs
    link
    fedilink
    arrow-up
    6
    ·
    3 years ago

    While it is practical and works, it is not an operator by itself. It a combination of two, the unary decrementation and greater than comparator.

    Read it as i-- > value.

    • xarvosOP
      link
      fedilink
      arrow-up
      6
      ·
      3 years ago

      As explained by multiple answers in the link :)

      I’m mainly pointing at the sarcastic answers on that link

      • Adda
        link
        fedilink
        arrow-up
        1
        ·
        3 years ago

        Yeah, I have just read through some of those. It is hilarious what people can come up with.

    • Ephera
      link
      fedilink
      arrow-up
      2
      ·
      3 years ago

      Honestly, I’m not sure which I think is worse. Having an explicit down-to operator or being able to combine operators in a way that confuses experienced programmers.

      • xarvosOP
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 years ago

        Kotlin has one (well, more like keyword, but aren’t operators just keywords written in non-alphabetic) downTo

        • Ephera
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          It wouldn’t have surprised me at all, if they did (they love their keywords), but that one actually isn’t a keyword. It’s an extension method implemented for the various number types, so you can also write 5.downTo(1).

      • dinomug
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 years ago

        This kind of combined operators are quite common in the competitive programming world, where the speed of coding is more important than readable.

        • Ephera
          link
          fedilink
          arrow-up
          4
          ·
          3 years ago

          Yeah, still horrid for real-world programming, though, where readability is ten times as important as how quickly you can type it out.

          • tmpod@lemmy.pt
            link
            fedilink
            arrow-up
            1
            ·
            3 years ago

            I’d argue the problem here is more the unary (in/de)crement operator. It isn’t really necessary and most of the time it doesn’t make stuff more readable.