Skip to content

Comment on What was the silliest issue you discovered during debugging?

You are viewing one comment and its replies. View all comments · View the comment above

Comments

  • “Yoda conditionals” are a must in languages where bindings/references are mutable by default. E.g.: “if (0 == size)” or “if (0x4269 == magic)”. If you write ‘=’ instead of ‘==’ you get a compiler error, so always put the constant first.

    7
    • Hope you never have to use a language that lets you redefine numbers.

      2
      • Wasn’t there a Python version where True and False were mutable by accident?

        I tend to use languages where immutability is the default these days like Haskell, Idris, or Purescript. But, even when using Java and Javascript, I tossed around a lot more final / const than my peers. :)

        2
        • Redefining the number 2 in Python

          The biggest const-by-default lang is probably Rust now isn’t it?

          2
          • Maybe? I don’t really keep up with lang popularity. Got through the Rust tutorial and did one project with it, but I honestly was missing HKTs and (mostly) isolating effects based on type signature. Of course, Rust may have grown those features since then, it was last decade when I played with it.

            0

Sign in to comment. Sign in