Skip to content

Dev/underscore #69

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Dev/underscore #69

wants to merge 2 commits into from

Conversation

y86-dev
Copy link
Member

@y86-dev y86-dev commented Jun 19, 2025

  • add code blocks to [try_][pin_]init! macros

y86-dev added 2 commits June 19, 2025 16:10
Allow writing `_: { /* any number of statements */ }` in initializers to
run arbitrary code during initialization. It also allows declaring
values that can be used later in the initializer:

    init!(MyStruct {
        _: {
            let val = if check_something() {
                42
            } else {
                0
            };
        },
        foo: Foo::new(val),
    })

Signed-off-by: Benno Lossin <[email protected]>
Signed-off-by: Benno Lossin <[email protected]>
@y86-dev
Copy link
Member Author

y86-dev commented Jun 19, 2025

@Darksonn in your proposal you said that only super let bindings would persist between different {} scopes in intializers. At the moment, this implements that behavior for normal let bindings. Any thoughts on that?

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

Successfully merging this pull request may close these issues.

1 participant