Hacker News new | ask | show | jobs
by DrMeepster 1616 days ago
This can never happen with regular string literals. String literals have the type `&'static str` but formatting returns a `String`.
1 comments

Perhaps something could be done with compile-time code execution, but the bigger problem is that it wouldn't be backwards-compatible. Currently "{foo}" is a perfectly valid string that doesn't evaluate anything.
In truth, it probably requires something like `f"foo {bar}"`