Comments for https://horstmann.com/unblog/2021-09-14/index.html
Comments for: https://horstmann.com/unblog/2021-09-14/index.html
- LLeonel Gayard @leonel.gayard
This article taught me there are now 4 kinds of switch. I knew about the original one and the one with arrows, but the "yield" one is new.
And it is a disaster. In Python and C#, "yield" and "yield return" are for generators/iterators, which are very useful, beloved features in those languages. In particular, in Python it can be used to create elegant pipelines. And newer languages, like Kotlin, already offer those from early on.
So, to have Java, which shuns new keywords for new features, bend this tradition to include a new keyword for a redundant feature AND it's not that useful feature we see in other languages... Sheesh!- CCay Horstmann @cayhorstmann
I don't think generators are on the roadmap for Java, so the damage is limited. My guess is that yield will prove about as popular in Java as labeled break/continue, i.e. mostly fodder for certification exams. Every language has a few questionable decisions over the ages. As Stroustrup said: “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”
- MIn reply tosystem⬆:Majid Barzegar @majidbarzegar
Will you write a book for Java 17 like core java 11th?
- CCay Horstmann @cayhorstmann
I am working on the revision of Core Java right now to bring it up to date for Java 17. It's almost done.