Hi Rémi, Thanks for your detailed explaining. Switch expression is useful in some cases, but fallthrough is error prone. I seldom use switch statement, in the past, I widely used it when I wrote lexer/parser by hand. I prefer to use if-else instead, which is much more powerful.
Though devil exists in some shapes of switch expression, Groovy may have to support all shapes for compatibility with Java. I am thinking about a general proposal for Groovy. The common way to transform statement to expression with parenthesis expression following `#`, e.g. ``` def a = 6 def r = #( if (a == 6) yield 'a' else yield 'b' ) assert 'a' == r ``` Cheers, Daniel.Sun ----- Apache Groovy committer & PMC member Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html