No internet connection
  1. Home

Comments for https://horstmann.com/unblog/2021-09-14/index.html

By System @system
    2021-09-17 14:47:07.968Z
    • 4 comments
    1. L
      Leonel Gayard @leonel.gayard
        2021-09-17 14:47:08.057Z

        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!

        1. CCay Horstmann @cayhorstmann
            2021-09-22 09:12:55.465Z

            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.”

          • M
            In reply tosystem:
            Majid Barzegar @majidbarzegar
              2021-09-21 20:07:08.124Z

              Will you write a book for Java 17 like core java 11th?

              1. CCay Horstmann @cayhorstmann
                  2021-09-22 09:00:14.840Z

                  I am working on the revision of Core Java right now to bring it up to date for Java 17. It's almost done.