Skip to content

Let-in binding syntax #11514

Closed
Closed
@luci1900

Description

@luci1900

I thought it would be interesting to be also able to bind a symbol only for the scope of the following expression, much like "let ... in" syntax in Haskell/ML.

So this

let a = 1 in a + 1

would be equivalent to this

{
    let a = 1;
    a + 1
}

Such syntax would also more closely align with match, where the symbols are scoped only in that arm of the match.

I've felt the need for this trying to write Some(&1) and having to fall back binding it separately, but I understand that will be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions