Yes it is only for longer statements, I didn’t write it here, it was in the linked PR:
- Using ternary operators only for simple conditions. - Splitting longer expressions across multiple lines. - Aligning the ? and : branches for readability. Gianluca Sartori -- https://dueuno.com On Tue, 28 Jul 2026 at 22:31, MG <[email protected]> wrote: > Paul already cleared this up, so just a quick reply: I assumed from your > post saying "We usually format ternary operators like this for readability" > that you meant in general - but if you meant only for longer (to be > defined, so an LLM-bot gets it ;-) ) expressions, yes, why not G-) > > Cheers, > mg > > > Am 28.07.2026 um 10:00 schrieb Gianluca Sartori: > > That's the idea, to use the multiline style only when there are longer > expressions like strings, method calls, etc. > > Anyway I just realized there is no `groovy-developer` skill in the groovy > project, maybe Grails is the right place to work on it? > > > Gianluca Sartori > -- > https://dueuno.com > > > On Mon, 27 Jul 2026 at 19:03, MG <[email protected]> wrote: > >> Hi Gianluca, >> >> I might misuderstand what you propose here, but for me the whole idea >> behind cond ? trueBranch : falseBranch is that it is a one-liner. >> Otherwise it is better suited for if-else-... >> >> Having said that, I can see that this way of formatting might make sense, >> if trueBranch and falseBranch are long(ish) String/GString|s (which we in >> our code do not have) - but as a general formatting rule, I would be >> against this. >> >> Cheers, >> mg >> >> >> Am 27.07.2026 um 14:38 schrieb Gianluca Sartori: >> >> Hi people, >> >> I've proposed the following PR to the Grails project in a rush, but I >> guess its proper place is the Groovy project. >> >> https://github.com/apache/grails-core/pull/16055 >> >> We usually format ternary operators like this for readability: >> >> String message = condition >> ? "Value when true" >> : "Value when false" >> >> Would you accept such PR on the groovy-developer skill? >> >> Cheers, >> Gianluca >> >> Gianluca Sartori >> -- >> https://dueuno.com >> >> >> >
