Star Trek Website
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Cipherd@lemmy.ml to Programmer Humor@lemmy.ml · 8 months ago

functions

lemmy.ml

message-square
35
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
286

functions

lemmy.ml

Cipherd@lemmy.ml to Programmer Humor@lemmy.ml · 8 months ago
message-square
35
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
alert-triangle
You must log in or # to comment.
  • potatoguy@lemmy.eco.brdeleted by creator
    link
    fedilink
    arrow-up
    43
    arrow-down
    1
    ·
    8 months ago

    And the best:

    public static void () {}

    spoiler

    /s

    • Baizey@feddit.dk
      link
      fedilink
      arrow-up
      4
      ·
      8 months 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@lemmy.eco.brdeleted by creator
        link
        fedilink
        arrow-up
        6
        ·
        8 months 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@feddit.org
        link
        fedilink
        arrow-up
        1
        arrow-down
        6
        ·
        8 months 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@lemmy.ml
          link
          fedilink
          arrow-up
          3
          ·
          7 months 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 • 𐑖ƨɤ@piefed.zip
    link
    fedilink
    English
    arrow-up
    29
    ·
    8 months ago

    :(){:|: &};:

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      12
      ·
      8 months ago
      :(){:|: &};:
      :(){:|: &};:
      
      • HumanPerson@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        9
        ·
        8 months ago
        :(){:|: &};:
        :(){:|: &};:
        :(){:|: &};:
        :(){:|: &};:
        
        • cryoistalline@lemmy.ml
          link
          fedilink
          arrow-up
          7
          ·
          8 months ago
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          
          • somerandomperson@lemmy.dbzer0.comdeleted by creator
            link
            fedilink
            arrow-up
            1
            ·
            7 months ago
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            :(){:|: &};:
            
  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    16
    ·
    8 months 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@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      2
      ·
      7 months ago

      This really sends me

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 months ago

      |{}

  • KSP Atlas@sopuli.xyz
    link
    fedilink
    arrow-up
    15
    ·
    8 months ago

    Haskell: =

    • codemankey@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 months ago

      The language of the gods

  • bleistift2@sopuli.xyz
    link
    fedilink
    arrow-up
    12
    ·
    8 months ago
    function() {}
    
    • davel [he/him]@lemmy.ml
      link
      fedilink
      English
      arrow-up
      13
      arrow-down
      1
      ·
      8 months ago

      JavaScript can do better than that:

      () => {}
      
      • Oriel Jutty :hhHHHAAAH:@infosec.exchange
        link
        fedilink
        arrow-up
        6
        ·
        8 months ago

        C++: [](){}

        • davel [he/him]@lemmy.ml
          link
          fedilink
          English
          arrow-up
          5
          ·
          8 months 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@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 months ago

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

  • davel [he/him]@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    8 months ago

    Some Lisp dialects: (λ () )

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 months ago

      your IDE is hiding 6 characters there

      • davel [he/him]@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        8 months ago

        Some Lisps will accept a literal Unicode lambda character.

  • The_Hideous_Orgalorg@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    8 months ago

    Remember kids:

    public void doFun();

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 months ago

      Teacher, I just voided myself in public, are we having fun?

  • benagain@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    7 months ago

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

  • Captain Aggravated@sh.itjust.worksBanned
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    3 months ago

    Removed by mod

    • 0xDREADBEEF@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      7 months ago

      that’s a class method not a function tho

      • Captain Aggravated@sh.itjust.worksBanned
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        3 months ago

        Removed by mod

        • 0xDREADBEEF@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          7 months ago

          I thought python was one of those weird OOP languages like Java or C# that bound all classless methods to some universal static class but im wrong on that.

          They are out there though so be on the lookout for these languages that doesnt believe in algebra.

          • Captain Aggravated@sh.itjust.worksBanned
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            3 months ago

            Removed by mod

        • Uairhahs@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          Nope Def is universal for definition of a function wether it be a class method main method or even nested method

  • Prunebutt@slrpnk.net
    link
    fedilink
    arrow-up
    3
    ·
    8 months ago

    Nix:

    x:;

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

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

  • solomonschuler@lemmy.zipdeleted by creator
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 month ago

    deleted by creator

  • somerandomperson@lemmy.dbzer0.comdeleted by creator
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    deleted by creator

  • bort@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    ·
    8 months ago

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

  • HiddenLayer555@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 months 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
      5
      ·
      7 months 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@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        1
        ·
        7 months 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.

  • 24 users / day
  • 502 users / week
  • 1.11K users / month
  • 4.66K users / 6 months
  • 124 local subscribers
  • 42.7K subscribers
  • 2.03K Posts
  • 40.5K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.mldeleted by creator
  • cat_programmer@lemmy.ml
  • BE: 0.19.19
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org