Skip to content

Conversation

@hanbings-agent
Copy link
Owner

Implement , let ... syntax for if/while conditions

This PR introduces a more natural let chain syntax for if and while conditions, allowing , let ... as a separator.

Why this change?
This change addresses the desire for a more intuitive way to chain let patterns in conditional expressions, aligning with discussions around RFCs for if-let chains.

How it works:
The parser now recognizes top-level , let ... within if/while conditions and transforms it into an equivalent && let ... in the Abstract Syntax Tree (AST). This approach ensures:

  • Semantic equivalence: Short-circuiting behavior, temporary lifetimes, and drop order remain identical to && let ... chains.
  • Reusability: It leverages the existing let-chain validation and lowering logic, minimizing new parsing complexity.
  • Clarity: The change is localized to if/while condition parsing, avoiding ambiguity with tuple expressions.

Related:


Open in Cursor Open in Web

Co-authored-by: agent <agent@hanbings.io>
@cursor
Copy link

cursor bot commented Dec 22, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants