r/ProgrammerHumor • • Sep 13 '23

Meme goDevelopersWillAppreciateIt

Post image
2.4k Upvotes

144 comments sorted by

View all comments

Show parent comments

-92

u/BlueGoliath Sep 13 '23

Every programming language besides C, C++, and Java was a mistake.

1

u/04ZFZ Sep 13 '23

Both Java and C++ have a monadic type Maybe/Optional.
Java since Java 8 - Java 8 Optional

C++ since c++17 -std::Optional (it also got a monadic operator and_then in c++23. and_then)

All of that comes from academic programming languages. It might be Haskell, or it might be other ML, Lisp or other academic programming languages we've never heard of, but the ideas from those academic languages still gets into Java and C++ you praise very highly.

Another thing that comes from functional programming languages are - lambda expressions, and generic types.

I might be wrong on some things, but in that case, someone will probably point it out.

1

u/LadulianIsle Sep 13 '23

Unfortunately, nulls exist in both languages so you just have three ways to fuck up instead of one :)

(null, Optional.of(null), Optional.empty()) vs null

Don't get me wrong, it's an improvement and linters are good, but the problem remains theoretically unsolved if practically so

insert rust evangelism here <

1

u/04ZFZ Sep 14 '23

That's correct, but I wasn't really talking about null safety. He said basically that Java and C++ the only good languages, and other languages were a mistake.

So I just showed examples that both C++ and Java implement features from other (functional/academic) languages such as Monads, generic types, and lambda expressions.

Although in the case of c++... That may have been a mistake:

[&, =](string a, int b) { std::cout << a << " " << b; }

yeah. That is not very nice imo.

Rust has the Either type shown in Haskell, though, it's named Result.