Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I hate Rust's solution because it's not a solution at all.

Interpolation only works in a small subset of cases, which makes you constantly having to think whether it can or can't be used in the current situation and requires endless churn when refactoring code.

At the very minimum, they need to allow it to work with field access.

On the other hand, in python, while examples like this site exist and are funny/weird/quirky in practice nobody cares, and they just enjoy using fstrings.



It's pretty straightforward? You can interpolate a variable in scope and apply modifiers to it. You can't interpolate arbitrary expressions (which field access would be). Alternatively, you can interpolate an arbitrary identifier, then specify a value for that identifier in the arguments.

The key is "identifiers, not expressions."


The person you're responding to didn't misunderstand (or ask) how it works. They just find it inconvenient.

It would be perfectly possible to add field access without needing to support arbitrary expressions. However, as someone coming from a C# background, I would very much prefer arbitrary expressions.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: