all 40 comments

sorted by: hot top controversial new old
[–] 91 points 3 years ago* (1 child)

Looks like it creates a few emoji printers in a vector, then prints them all. The output is all emoji, of course. The main function exits with a random return value just to be more quirky.

I'm not sure what the purpose of the 😎 function is. In main that first predicate is always true, so it prints the poop emoji. I don't know why it's behind an if.

Also, there's a copy-paste error on line 31. Wrong emoji is used.

  • source
  • hideshow 1 child comment
  • [–] 50 points 3 years ago (2 children)

    Wow that's horrible. They're using c++.

  • source
  • hideshow 2 child comments
  • [–] 37 points 3 years ago* (last edited 3 years ago) (6 children)

    It would be great to use some emojis in coding.

    Imagine how much more readable it would be if you could break a loop with 💀 or return true with 👍. Or use ❓for ifs, or ↔️ for switch (the emoji didn't work for that one). Or use an emoji to represent a custom object?

    Maybe the ECMA should get on that!

    Edit: I guess you can use emojis for custom objects in js.

    Edit 2: ➡ for console.log

  • source
  • hideshow 6 child comments
  • [–] 2 points 3 years ago

    Programming typefaces with ligatures are a step in this direction.

    I would try this in something like Haskell, where some of the more exotic character sequences get tricky to recognise.

    Unison might be the best language to test this in. Having identifiers separate from the actual definitions, you can call anything whatever you want.

  • source
  • parent
  • [+] 20 points 3 years ago* (last edited 3 years ago)
    [–] 18 points 3 years ago*

    💩
    🍊
    🍉
    🍉
    🍍
    🍎

  • source
  • [–] 17 points 3 years ago

    Surprisingly more readable than standard C++

  • source
  • [–] 15 points 3 years ago (2 children)

    I didn’t bother trying to see what an output would be, but this is a nightmare.

  • source
  • hideshow 2 child comments
  • [–] 11 points 3 years ago (2 children)
  • [–] 11 points 3 years ago* (last edited 3 years ago)

    This just prints:

    💩
    🍊
    🍉
    🍉
    🍍
    🍎
    

    Line 38 and 39 just check if a function that always returns false is false and if so, prints "💩\n". (C++ uses the bit shift operator for file IO for some reason)

    Line 41 creates a vector of shared pointers to an abstract class, or in other words, an array of functions. Each function prints the emoji, mostly the same as the name, but not always. ( 🍒 is the exception, it prints "🍉\n")

    43 and 44 just loop over the array and call every function inside, printing a bunch of emoji.

    Line 46 returns the result of std::rand(), but because the programer forgot to call srand, the result is always the same (1804289383 for me).

    (There are also a few missing includes, but I doubt this is intentional)

  • source
  • [–] 10 points 3 years ago

    Genius honestly

  • source
  • [–] 10 points 3 years ago
    [–] 10 points 3 years ago

    Now imagine the poor sod who gets this as an interview question

    "Please extend the following code in the same code style to sort [😀,😃,😄,😁,😆] using bubble sort"

  • source
  • [–] 7 points 3 years ago (1 child)
  • [–] 6 points 3 years ago

    Mojo prepared me for this with their filename extension .🔥

  • source
  • [–] 4 points 3 years ago

    Ive written a transpiler for JS that allows emojis. I call it emojs: https://github.com/f-kirchhoff/emojs

  • source
  • [–] 4 points 3 years ago (2 children)
  • [–] 4 points 3 years ago

    Assembly but the commands are emojies🤯

  • source
  • [–] 3 points 3 years ago

    This... this... this is... GENIUS.

    Utter madness, sure. Genius nonetheless.

  • source
  • [–] 3 points 3 years ago

    Haha did the same thing years ago to make the code look like free flowing text.

  • source
  • [–] 3 points 3 years ago

    I think you could pull a similar breach of geneva conventions quite easily with Nim, probably even beyond what you can with C++

    No, I'm not intelligent, nor crazy enough to try that

  • source
  • [–] 3 points 3 years ago* (2 children)

    i'm not used to c++ but...
    int main() ?

  • source
  • hideshow 2 child comments
  • [–] 2 points 3 years ago

    Can you string match emojis

  • source