3 ms·
I prefer Rust's: format!("{a} {c} {b}", a="a", b='b', c=3) In real world projects, you will often transform at interpolation site which is better with Rus
by hombre_fatal 7y ago
I prefer Rust's:
format!("{a} {c} {b}", a="a", b='b', c=3)
In real world projects, you will often transform at interpolation site which is better with Rust's format! syntax since it won't clutter the inline string. Not something I think is worth bike-shedding further.
- xixixao 7y agoOk, how about we agree both mine and your concerns are equivalently important? With real interpolations, you can do: a = "a" b = 'b' c = 3 "{a} {c} {b}" Your concern is addressed, with real interpolations, already.
- db48x 7y agoIt's a perfectly valid complaint, though I don't think it's all that critical. For debugging, the `dbg` macro is the way to go, so you can skip string interpolation for that entirely (see https://doc.rust-lang.org/std/macro.dbg.html https://doc.rust-lang.org/std/macro.dbg.html for details). And when you do want to use string interpolation, you can always grab a crate such as interpolate or any of the others. (https://crates.io/search?q=interpolate https://crates.io/search?q=interpolate). No need to change how the language works when you can download or build a library that suits you.