• steventhedev@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    16 days ago

    Clearly your gender field is a boolean. Which means it can be either true, false, null, or undefined. Except in javascript where for some reason it can sometimes be NaN, but only when you try to compare two people.

    • ZILtoid1991@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      15 days ago

      That’s why you use bitarrays and bitflags instead when you need more than just one or two arguments for a function.

      • Excrubulent@slrpnk.net
        link
        fedilink
        English
        arrow-up
        0
        ·
        15 days ago

        Only if it’s performance sensitive. Otherwise you’re wasting programmer time both writing and reading the code, and you’ve made it less maintainable with more complexities where bugs can creep in.

        The vast majority of the time you can afford a few wasted bits.

        Honestly though I don’t quite understand why a compiler couldn’t optimise this process. Like it knows what a boolean is, surely it could reduce them down to bits.