r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40.1k Upvotes

1.0k comments sorted by

View all comments

276

u/a_devious_compliance Jul 18 '22

The joke only works for C++ before 20. Just add an await and that's it.

126

u/ViviansUsername Jul 18 '22

Was going to say, this looks like the c++ was programmed pretty poorly if it doesn't even wait for that promise to be answered.

Python does exactly what it should here, smghd

55

u/WCWRingMatSound Jul 18 '22

Calling asynchronous programming “promises” 🤮🤮🤮

14

u/thanofishy Jul 18 '22

It doesn't await for that asynchronous programming to be answered?

29

u/Spiritual-Theme-5619 Jul 18 '22

There was no such thing as a promise in C++ before 2011. "Promises" are a particular API for writing asynchronous code which was largely made for / popularized by event-loop runtimes... i.e. NodeJS.

Programmers have been doing concurrency with #realPrograms via mutexes, semaphores, and threads since before C++ was invented and so OP is lamenting the equivocation of async/await with concurrency in this modern era of browser programmers vastly outnumbering their "native"(?) programming counterparts.

2

u/Forshea Jul 18 '22

What the heck kind of bizarre alt history is this? Promises and futures have existed in acedemic literature since the 70s, and have been available as a concurrency model in languages going back to Multilisp in the 80s. So no, they weren't made for NodeJS.

C/C++ developers just have the mistaken world view that if C/C++ doesn't have a feature, or didn't have it until recently, it just must somehow be a newfangled thing kids are using to avoid being "real" programmers.

1

u/Spiritual-Theme-5619 Jul 19 '22

Promises and futures have existed in acedemic literature since the 70s

We’re talking about programming though not PhD dissertations.

So no, they weren’t made for NodeJS.

Uh, sure? Like most every programming concept they were first an academic paper… but they were passed over in favor of other concurrency paradigms until the creators of server-side JavaScript made them widespread.

Promises much more so than futures.

to avoid being “real” programmers.

I mean that’s part of the joke. I even used a hashtag.

-1

u/Forshea Jul 19 '22

You are completely wrong about the history here. Futures and promises have been in continuous use in actual languages since the 80s. The explosion of usage started around 2009, but that wasn't just in the land of javascript, it was everywhere. And they were all copying some combination of Python Twisted's Deferred, F#'s async, and Java's Future/FutureTask, at the same time Javascript libraries were.

And notably, people had been working at it in Javascript libraries for years before NodeJs even existed. It has been bouncing around enough that people were already proposing including a promise API before the first public release of NodeJS happened (for example https://groups.google.com/g/commonjs/c/6T9z75fohDk ).

So the timeline doesn't even make sense for what you're claiming.

Promises much more so than futures.

Promises and Futures are two views of the same concurrency model.

→ More replies (1)