Skip to content

Polish ternary operator #45156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Polish ternary operator #45156

wants to merge 1 commit into from

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Apr 11, 2025

No description provided.

Signed-off-by: Yanming Zhou <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 11, 2025
@philwebb
Copy link
Member

Thanks, but we generally negate the test in ternary expressions.

@philwebb philwebb closed this Apr 11, 2025
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 11, 2025
@philwebb philwebb reopened this Apr 11, 2025
@philwebb philwebb added type: task A general task and removed status: declined A suggestion or change that we don't feel we should currently apply labels Apr 11, 2025
@philwebb philwebb self-assigned this Apr 11, 2025
@snicoll snicoll modified the milestones: 3.5.0-RC1, 3.3.11 Apr 11, 2025
@snicoll snicoll changed the title Polish commit 935d7597542bd0da8ece940cc2f8d6bb05fd27f3 Polish ternary operator Apr 11, 2025
@philwebb
Copy link
Member

It turns out I didn't quite get the reason we prefer the negation first. After some discussion with @snicoll I've seen the light! We're really trying to enforce (predicate) ? main : fallback and that's why we mostly end up using != null. I'll merge this one after all.

philwebb pushed a commit that referenced this pull request Apr 11, 2025
See gh-45156

Signed-off-by: Yanming Zhou <[email protected]>
@philwebb philwebb closed this in a6f54ec Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants