• steventhedev@lemmy.world
    link
    fedilink
    arrow-up
    34
    ·
    7 months 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
      9
      ·
      7 months 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
        6
        ·
        7 months 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.

        • calcopiritus@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          7 months ago

          Well, to get a boolean out of a bit array you have to do some operations. So at first it doesn’t make it more performant. Compilers probably don’t automatically make them bitarrays because of that.

          However, the memory savings means less cache used. And a cache miss is way more expensive than those bit operations. So they should be more performant. I’m sure someone out there has done the actual research and there’s a good reason why compilers don’t make all booleans bitarrays.

    • Gladaed@feddit.org
      link
      fedilink
      arrow-up
      9
      ·
      7 months ago

      That’s only due to technical reasons on weird platforms like x86, 64bit x86 or ARM.

  • bishbosh@lemm.ee
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    1
    ·
    7 months ago

    Bold of programmers to assume gender can be expressed accurately in a finite discrete system. Gonna have to bust the Taylor series for some better approximation.

    • apotheotic (she/her)@beehaw.org
      link
      fedilink
      English
      arrow-up
      6
      ·
      7 months ago

      I guess in theory as there will only ever be a finite number of individuals, there will also necessarily only ever be a finite number of different gender expressions, so finite discrete probably works. (Not to say that peoples experiences of gender are fixed and equidistant, but more so that you could have a “gender enum” with an entry for each individual)

      Of course, trying to say how many bits this would require is almost impossible because theres always going to be more people and more genders, but it is technically finite.

      In any case, bagsies on (leading zeros)100101001

      • bishbosh@lemm.ee
        link
        fedilink
        English
        arrow-up
        0
        ·
        7 months ago

        finite number of individuals, there will also necessarily only ever be a finite number of different gender expressions

        This only demonstrates that there will be a finite number of genders at any given instance. One could be more fluid and a responsive gender such that it maximizes the gay of any particular kiss they are having at the time.

        • apotheotic (she/her)@beehaw.org
          link
          fedilink
          English
          arrow-up
          1
          ·
          7 months ago

          Sure but thats their experience of gender right? Their experience of gender will never be “not their experience of gender” even if it changes from instant to instant

          • bishbosh@lemm.ee
            link
            fedilink
            English
            arrow-up
            0
            ·
            7 months ago

            Sure, but just because sine is one function doesn’t mean it’s accurately replicable in a finite discrete system.

            I read your previous comment as making the point that because there are finite people, there will be finite values of gender, and therefore discrete and replicable. If it’s continuous and variable, even if there are finite individuals that have finite methods of expressions their gender, gender itself spans the reals.

            • apotheotic (she/her)@beehaw.org
              link
              fedilink
              English
              arrow-up
              2
              ·
              7 months ago

              I was more approaching it from a programming perspective than a mathematical one - we could theoretically “label” all the gender experiences (perhaps just with the name of the individual that experiences it)

              Of course this would be like labeling different variations of the sine function, and other functions, to use the analogy you made

              The thing thats represented by the label may be discrete or continuous or anything

              To be clear, I’m not attempting to represent gender as a continuous spectrum between Man and Woman - I’m throwing the gender binary out entirely and imagining each gender as some arbitrarily defined thing, ie for some people its a sine function (again to use your analogy) with different coefficients

              If one wanted to represent the “gender space” as some 1d number line or 2d space with cartesian axes, then absolutely you’d need to fulfil the infinite and continuous criteria and I agree with you.

              Though, to ramble a bit, I don’t know what you’d use to label the axis/axes because we sure as hell can’t use Man to Woman when agender folk exist, and we can’t even use Man to Woman and Agender to Allogender because some folk would fall outside of those axes still.

    • ZILtoid1991@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      7 months ago

      Gender is a struct

      struct Gender {
        byte binaryBias;    ///Determines male (+) or female (-) bias if present
        ubyte binaryAm;    ///Determines the amount of binary gender(s) present
        bool isTrans;    ///True if assigned at birth gender does not equal with current one
        ubyte xenoAm;    ///Determines the amount of xenogender
        uint xenoGen;    ///Xenogender selection, 0 if not applicable
        Sex* sex;    ///Pointer to the person's current sex
      }
      
  • Abnorc@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    7 months ago

    Gender is a second order tensor, so you should store it as a pointer to an array of pointers for maximum read/write speed.