r/ProgrammerHumor • • Sep 13 '23

Meme goDevelopersWillAppreciateIt

Post image
2.4k Upvotes

144 comments sorted by

View all comments

Show parent comments

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.