Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
Cipherd ( cipherd@lemmy.ml )  to Programmer Humor@lemmy.ml · 1 year ago

functions

lemmy.ml

message-square
26
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
189

functions

lemmy.ml

Cipherd ( cipherd@lemmy.ml )  to Programmer Humor@lemmy.ml · 1 year ago
message-square
26
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
alert-triangle
You must log in or register to comment.
  • potatoguy ( potatoguy@lemmy.eco.br ) deleted by creator
    link
    fedilink
    arrow-up
    26
    ·
    1 year ago

    And the best:

    public static void () {}

    spoiler

    /s

    • Baizey ( Baizey@feddit.dk ) 
      link
      fedilink
      arrow-up
      3
      ·
      1 year 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

      • potatoguy ( potatoguy@lemmy.eco.br ) deleted by creator
        link
        fedilink
        arrow-up
        6
        ·
        1 year 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.

      • RaphaelSchmitz ( RaphaelSchmitz@feddit.org ) 
        link
        fedilink
        arrow-up
        1
        ·
        1 year 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 girly ( orc_princess@lemmy.ml ) 
          link
          fedilink
          arrow-up
          3
          ·
          1 year 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.

  • Ŝan • 𐑖ƨɤ ( Sxan@piefed.zip ) 
    link
    fedilink
    English
    arrow-up
    17
    ·
    1 year ago

    :(){:|: &};:

    • bleistift2 ( bleistift2@sopuli.xyz ) 
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 year ago
      :(){:|: &};:
      :(){:|: &};:
      
  • Ephera ( Ephera@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    12
    ·
    1 year 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…

    • vala ( vala@lemmy.dbzer0.com ) 
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      This really sends me

    • tetris11 ( tetris11@feddit.uk ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      |{}

  • KSP Atlas ( KSPAtlas@sopuli.xyz ) 
    link
    fedilink
    arrow-up
    12
    ·
    1 year ago

    Haskell: =

    • codemankey ( codemankey@programming.dev ) 
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      The language of the gods

  • davel [he/him] ( davel@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 year ago

    Some Lisp dialects: (λ () )

    • tetris11 ( tetris11@feddit.uk ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      your IDE is hiding 6 characters there

      • davel [he/him] ( davel@lemmy.ml ) 
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        Some Lisps will accept a literal Unicode lambda character.

  • bleistift2 ( bleistift2@sopuli.xyz ) 
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago
    function() {}
    
    • davel [he/him] ( davel@lemmy.ml ) 
      link
      fedilink
      English
      arrow-up
      9
      ·
      1 year ago

      JavaScript can do better than that:

      () => {}
      
      • Oriel Jutty :hhHHHAAAH: ( barubary@infosec.exchange ) 
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        C++: [](){}

        • davel [he/him] ( davel@lemmy.ml ) 
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          Huh, I haven’t looked at C++ in decades, and I didn’t know they’d added lambda functions/expressions, in C++11. Apparently you can shorten it further: []{}

      • bleistift2 ( bleistift2@sopuli.xyz ) 
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        The intention was to provide a longer version for the first step of the ladder.

  • benagain ( benagain@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    They could have put php up the top where it belongs.

  • Prunebutt ( Prunebutt@slrpnk.net ) 
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Nix:

    x:;

  • solomonschuler ( solomonschuler@lemmy.zip ) deleted by creator
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    5 months ago

    deleted by creator

  • bort ( bort@sopuli.xyz ) 
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    kotlin also has ()->{} and {} (when there is just 1 parameter)

  • somerandomperson ( somerandomperson@lemmy.dbzer0.com ) deleted by creator
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    deleted by creator

  • HiddenLayer555 ( HiddenLayer555@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

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

    • chaos ( chaos@beehaw.org ) 
      link
      fedilink
      arrow-up
      5
      ·
      1 year 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.

      • anton ( anton@lemmy.blahaj.zone ) 
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Mostly a great comment, but I wouldn’t compare unit to null, it’s more like the void type.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 41 users / week
  • 42 users / month
  • 1.56K users / 6 months
  • 871 local subscribers
  • 43.7K subscribers
  • 1.25K Posts
  • 10.2K Comments
  • Modlog
  • mods:
  • AgreeableLandscape ( AgreeableLandscape@lemmy.ml ) deleted by creator
  • cat_programmer ( cat_programmer@lemmy.ml ) 
  • BE: 0.19.21
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code