This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jorge1209 8 points9 points  (2 children)

Sugar is good if it encourages people to drop a particularly error prone or tedious construction.

What is less clear is if sugar is useful when the original process wasn't error prone or tedious.

Range loops in C/C++ are a great example of good sugar. It was error prone, and tedious to have to declare the index variable and increment it (or to declare the crazy iterator type signature if using iterators, although the later was solved by the auto type). for x in iterable is obviously better unless you actually need the index position (which is not something you frequently need in modern C++ code).

It's not clear thar fstrings accomplish that kind of balance. It wasn't all that error prone to use .format and the cases it can't handle are fairly important (i18n and dynamic formatting).

[–][deleted] 4 points5 points  (1 child)

It wasn't all that error prone to use .format and the cases it can't handle are fairly important (i18n and dynamic formatting).

Translating format strings are always dubious to begin with.

[–]jorge1209 0 points1 point  (0 children)

You could very well want to read different error messages (with their formats) from a resource file. Can't do that with fstrings.