all 39 comments

sorted by: hot top controversial new old
[–] 41 points 10 months ago (4 children)

And the best:

public static void () {}

spoiler/s

  • source
  • hideshow 4 child comments
  • [–] 4 points 10 months ago (3 children)

    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

  • source
  • parent
  • hideshow 3 child comments
  • [–] -4 points 10 months ago* (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 10 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.

  • source
  • parent
  • [–] 30 points 10 months ago (4 children)
  • [–] 12 points 10 months ago (3 children)
  • [–] 9 points 10 months ago* (2 children)
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    
  • source
  • parent
  • hideshow 2 child comments
  • [–] 7 points 10 months ago (1 child)
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    :(){:|: &};:
    
  • source
  • parent
  • hideshow 1 child comment
  • [–] 17 points 10 months ago (2 children)

    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...

  • source
  • hideshow 2 child comments
  • [–] 15 points 10 months ago (1 child)
  • [–] 12 points 10 months ago (4 children)
  • [–] 13 points 10 months ago (3 children)

    JavaScript can do better than that:

    () => {}
    
  • source
  • parent
  • hideshow 3 child comments
  • [–] 10 points 10 months ago (2 children)

    Some Lisp dialects: (λ () )

  • source
  • hideshow 2 child comments
  • [–] 4 points 10 months ago

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

  • source
  • [–] 4 points 10 months ago (1 child)

    Remember kids:

    public void doFun();

  • source
  • hideshow 1 child comment
  • [–] 3 points 10 months ago (4 children)

    Python: def :

    derpface.jpg

  • source
  • hideshow 4 child comments
  • [–] 0 points 10 months ago* (3 children)

    that's a class method not a function tho

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 10 months ago (2 children)

    AFAIK the syntax seems to be the same.

    def sayHam():
        print("Ham")
    
    sayHam()
    

    works when typed into the Python console, no class needed. I program as a hobby, I'm no expert on the language, but does Python even differentiate between functions and class methods internally? Other than just scope? There's a possibility I'll learn something today.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 10 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 10 months ago
    [–] 2 points 10 months ago

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

  • source
  • [+] 1 point 4 months ago* (last edited 3 months ago)
    [+] 1 point 10 months ago
    [–] 1 point 10 months ago* (2 children)

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

  • source
  • hideshow 2 child comments
  • [–] 5 points 10 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 10 months ago

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

  • source