• Lembot_0004@discuss.online
    link
    fedilink
    arrow-up
    9
    ·
    26 days ago

    It might be an absolutely adequate method. Imagine that is C++. operator-- is overloaded and controls some machinery. You can’t just command capacity = currSize. Process is important.

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      26 days ago

      Yeah, just to say it more clearly: that kind of thing is why lots of people out there insist that operator overloading is a bad idea.

      And yeah, it’s a C++ thing that mostly doesn’t happen in other languages.

      • TeamAssimilation@infosec.pub
        link
        fedilink
        arrow-up
        1
        ·
        26 days ago

        Sincerely agree. Explicit is better then implicit, that’s a general engineering axiom.

        Instead of overloading and making the next maintainer hunt for overloads, a clearly named function that does the critical steps would make the code immensely more maintainable. C++ is C gone wild.