• Omega_Haxors@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    8 months ago

    Why even use variables in the first place? Just place the values directly into your code. If you need to change a value, that’s just bad planning. Hell, why even use values either? Just run a loop on the INC instruction until you get the value you need. It’s just efficient programming.

  • 9point6@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    8 months ago

    Const everything by default

    If you need to mutate it, you don’t, you need to refactor.

    • noli@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      8 months ago

      Dogmatic statements like this lead to bad, messy code. I’m a firm believer that you should use whatever style fits the problem most.

      Although I agree most code would be better if people followed this dogma, sometimes mutability is just more clean/idiomatic/efficient/…

      • Corbin@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        arrow-down
        1
        ·
        8 months ago

        Define your terms before relying on platitudes. Mutability isn’t cleaner if we want composition, particularly in the face of concurrency. Being idiomatic isn’t good or bad, but patterned; not all patterns are universally desirable. The only one which stands up to scrutiny is efficiency, which leads to the cult of performance-at-all-costs if one is not thoughtful.