News for hackers. Stuff that matters.
Re:Rust 1.58.0 by pornel on Thursday January 13, 2022 @02:46PM (#29925792)
Because arbitrary expressions open a pandora box that complicates everything touching them.

For example, expressions can be strings, so now you have strings inside strings, and the strings may even contain further levels of nested formatting strings. This would make correct tokenization of Rust quite difficult, and out of reach of most syntax highlighting tools.

So the next question is why not allow only some "simple" expressions. It would require teaching users which expressions are allowed and which aren't. The rule that only a single identifier is allowed is both simple to parse, and simple to teach.

Re:Rust 1.58.0 by edflsafoiewq on Thursday January 13, 2022 @04:05PM (#29926843)
It's hardly a rare feature. Everything from C# to JS has it these days, so I think "out of reach of most syntax highlighting tools" might be overstating things a bit. It can't be that hard.

You don't have to allow nested strings either; Python's f-strings don't, they always parse as a regular string too (well, you can use a 'single-quoted string' inside a "double-quoted f-string").

Re:Rust 1.58.0 by dataangel on Saturday January 15, 2022 @06:09PM (#29951412)
You can have nested quotes already, arbitrarily many levels deep.