• andyburke@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Old programmers shouting at clouds.

    (Old programmer here, I just shout at differently shaped clouds than this one.)

    Edit: I am not sure if the respondents to this comment think I have a horse in this race. I said I don’t and that I shout at different clouds. I am just here answering a question.

    • floofloof@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      1 month ago

      Another old programmer here, and I don’t see the issue. C# gets better with every release and the null coalescing assignment operator is very handy. It also exists in JavaScript.

      • LeFrog@discuss.tchncs.de
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        1 month ago

        Ruby has it as well:

        a ||= b
        
        # which means
        a = a || b
        # wich is the same as
        a = b if !a
        # which rubyists like to write as
        a = b unless a
        # or as ternary
        a = a ? a : b
        
        • Victor@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          1 month ago

          That’s way too many ways of doing the same thing, yuck.

          But you’re saying the idiomatic way is to use unless, rather than the actual operator for this?

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        I feel like it boils down to understanding that operator. I’m a TypeScript developer by trade so I had no issue understanding this. 🤷‍♂️