Skip to content
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

RFC: let-else statements #3137

Merged
merged 25 commits into from
Jul 21, 2021
Merged

RFC: let-else statements #3137

merged 25 commits into from
Jul 21, 2021

Commits on Jun 1, 2021

  1. let-else first draft

    Fishrock123 committed Jun 1, 2021
    Configuration menu
    Copy the full SHA
    2b92ef5 View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2021

  1. let-else draft updates from zulip

    Specifically bstrie's suggestion of `ExpressionWithoutBlock`.
    
    Also some spelling fixes and example updates.
    Fishrock123 committed Jun 2, 2021
    Configuration menu
    Copy the full SHA
    3438586 View commit details
    Browse the repository at this point in the history
  2. let-else draft updates for if-let-chains

    Thanks to Frank Steffahn for pointing this out in Zulip.
    Fishrock123 committed Jun 2, 2021
    Configuration menu
    Copy the full SHA
    c131adb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c9e75dc View commit details
    Browse the repository at this point in the history
  4. let-else draft, add desugar example

    By request of Josh Triplett
    Fishrock123 committed Jun 2, 2021
    Configuration menu
    Copy the full SHA
    d9e8bd4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b5c3456 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2021

  1. let-else draft, remove old example

    Also mentions the diverging return type of `!` in the summary.
    Fishrock123 committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    059587f View commit details
    Browse the repository at this point in the history
  2. let-else: rfc PR link

    Fishrock123 committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    93c1f7c View commit details
    Browse the repository at this point in the history
  3. let-else: inital updates from Josh

    Co-Authored-By: Josh Triplett <[email protected]>
    Fishrock123 and joshtriplett committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    836f2c4 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2021

  1. Configuration menu
    Copy the full SHA
    22e8430 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d25d51a View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2021

  1. let-else, multiple updates

    - Example now shows side-effects and dependence, cannot be reproduced by a single large `match`.
    - Note lazy boolean operator dis-allowance more prominently
    - Note `irrefutable_let_patterns` lint warning.
    - Make a decision for the if-let-chains future possibility: just disallow the problematic case
    - Clarify the note about `static` and `const` _items_.
    - Add section about "let-else within if-let" (I guess this RFC had it coming for it)
    Fishrock123 committed Jun 8, 2021
    Configuration menu
    Copy the full SHA
    f3473f6 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2021

  1. let-else, another round of updates

    - Clarify the diverging return type to be anything which returns never.
    - More detailed desugaring example with the above point.
    - Get rid of `BlockExpressionDiverging`.
    - Alternative: `let` assignment from `match`.
    - Alternative: `||` in pattern matching.
    - Prior art: `guard!` macro.
    Fishrock123 committed Jun 14, 2021
    Configuration menu
    Copy the full SHA
    6a9a9ef View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2021

  1. let-else, avoid let-else within if-let

    per Josh's recommendation and general discussion
    Fishrock123 committed Jun 17, 2021
    Configuration menu
    Copy the full SHA
    18ebdca View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    324117c View commit details
    Browse the repository at this point in the history
  3. let-else, note let-else-else-chains

    Most of this was Josh's suggestion and some is his words almost verbatim.
    
    Co-Authored-By: Josh Triplett <[email protected]>
    Fishrock123 and joshtriplett committed Jun 17, 2021
    Configuration menu
    Copy the full SHA
    bb81a98 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ff866ea View commit details
    Browse the repository at this point in the history
  5. let-else, update || example desugar

    Thanks to lebensterben for catching this one
    Fishrock123 committed Jun 17, 2021
    Configuration menu
    Copy the full SHA
    a4d9456 View commit details
    Browse the repository at this point in the history
  6. let-else, variable name spelling

    long sigh
    Fishrock123 committed Jun 17, 2021
    Configuration menu
    Copy the full SHA
    cab12fc View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2021

  1. let-else, PFCP updates

    - Clarify that `: TYPE` is allowed, as per Josh
    - Note the expression restriction more accurately and with more detail, as per Niko
    - Removed the option-chaining example, because many people keep stopping at that to comment.
    - Note a macro as an (unfavorable) alternative.
    Fishrock123 committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    89c5b6e View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2021

  1. let-else, fix a never type link

    Co-authored-by: J. Frimmel <[email protected]>
    Fishrock123 and jfrimmel authored Jul 2, 2021
    Configuration menu
    Copy the full SHA
    54bca55 View commit details
    Browse the repository at this point in the history

Commits on Jul 13, 2021

  1. let-else, FCP updates

    Hopefully this will be my last round of updates.
    
    - Added some unresolved questions.
    - Fixed some typos / english language clarification.
    - Clarified that all expressions ending in `}` should be disallowed.
    - Fixed some errors in examples.
    - Added section on `, else`.
    - Updated the `unless let` section to be "Introducer syntax" with the noted keyword being `guard`.
    - Noted the `DIVERGING_EXPR` section with more detail.
    Fishrock123 committed Jul 13, 2021
    Configuration menu
    Copy the full SHA
    c0c2fcc View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2021

  1. let-else, Mario's edits

    Excluding the block grammar clarifications for now, because those have evolved somewhat in Zulip.
    
    Co-authored-by: Mario Carneiro <[email protected]>
    Fishrock123 and digama0 authored Jul 19, 2021
    Configuration menu
    Copy the full SHA
    76e8bb5 View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2021

  1. let-else, disallow any expr ending with }.

    As per discussion in GitHub and Zulip, this seems like the most straightforward path until practical experimentation can be done.
    Fishrock123 committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    b6b87d6 View commit details
    Browse the repository at this point in the history
  2. let-else, mention macro expansions

    Forgot this in the last commit. Invisible groupings from macros should be allowed but should be shown to humans in visible expansion tools.
    Fishrock123 committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    952745b View commit details
    Browse the repository at this point in the history