-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
The new strformat.% operator introduces unnecessary friction. Not only it collides with json.%, it doesn't have any visual meaning, nor it is introduced to the newcomers as some almost-built-in operator like & and $ for working with strings.
The problem of collision with json module is underestimated, imo. import smth except % is not a nice solution when copying code from a file where stformat.% used to work, to a file where json.% used to work. Since both modules are stdlib, they should play nicely with each other.
As a solution to this problem I would recommend introducing the $ macro overloaded by nkStrLit, while reducing existing $(s: string) to match only against non-literal values. As a next step, new $ interpolating macro could be brought to system.nim.
Reasoning:
- It is extremely unlikely that anyone is currently using
$with a string literal. $is already known to be a stringification operator, so$"myInterpolatedString"would make much more sense visually.