Skip to content

Conversation

@villor
Copy link

@villor villor commented Jul 27, 2025

bevyengine#20158

The #-syntax currently allows specifying names using Idents, which is nice.

This PR extends it to also support arbitrary expressions enclosed in braces:

let n = 5;
bsn! {
     #{format!("Tab_{n}")} Node
}

@cart cart merged commit fbae074 into cart:next-gen-scenes Jul 30, 2025
@cart
Copy link
Owner

cart commented Jul 30, 2025

I like it! I had inklings of a plan to do the same thing :)

@villor
Copy link
Author

villor commented Jul 31, 2025

If it turns out string interpolation using #{format!("...")} is a very common occurence
A future idea is to also have #"..." automatically expand like #{format!("")}:

let n = 5;
bsn! {
     #"Tab_{n}" Node
}

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.

2 participants