• Echo5@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    6 hours ago

    Idk much about programming but that looks like a beautiful reduction of bloat in coding language 😶

  • HiddenLayer555@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    7 hours ago

    I don’t use any but I’m sure there are functional languages where () is a valid function.

    • chaos@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      4 hours ago

      In Haskell, that’s “unit” or the empty tuple. It’s basically an object with no contents, behavior, or particular meaning, useful for representing “nothing”. It’s a solid thing that is never a surprise, unlike undefined or other languages’ nulls, which are holes in the language or errors waiting to happen.

      You might argue that it’s a value and not a function, but Haskell doesn’t really differentiate the two anyway:

      value :: String
      value = "I'm always this string!"
      
      funkyFunc :: String -> String
      funkyFunc name = "Rock on, "++name++", rock on!"
      

      Is value a value, or is it a function that takes no arguments? There’s not really a difference, Haskell handles them both the same way: by lazily replacing anything matching the pattern on the left side of the equation with the right side of the equation at runtime.

  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 day ago

    Bash fucks me up so much, too. You just put the parentheses there to say that something is a function, not for actually declaring the parameters that can be passed in…

    • Baizey@feddit.dk
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

      Technically java would also be (){} since the modifiers are optional (outside of public static void main(String… args)) and return type is ignore for the others :D

      • RaphaelSchmitz@feddit.org
        link
        fedilink
        arrow-up
        0
        arrow-down
        3
        ·
        edit-2
        18 hours ago

        Yeah the thing is that each part of “public static void” is a feature. Which other languages don’t have.

        Still makes a good meme for programmers who are not experienced enough to know that.

        • orc_princess@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          6 hours ago

          Many other languages have a more readable way of conveying access, class vs instance methods, and of course return type.

          Newer Java versions look great but the industry is slow to catch on, I’ve worked with Java 8 for an NGO for only a few months before landing a better job with a different language and the amount of boilerplate we made in just that little while is insane. A lot of it is generated by the IDE, sure, but it’s so incredibly redundant.

      • potatoguy@lemmy.eco.br
        link
        fedilink
        arrow-up
        4
        ·
        1 day ago

        Yeah, it’s a joke, but I disagree on the void, the other languages on the meme doesn’t need a return type (when they are returning nothing), java needs it.