-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make string interpolation and builtins.toString
behave the same
#7327
Comments
At least make integers work... the rest are of more debatable value, but integers working in antiquotes is just basic functionality in any decent language at this point. |
String interpolation has different behavior from Additionally, implicit type conversions are usually a source of pitfalls, so it is actually good that string interpolation is limited to the absolute essentials (i.e. Nix would be painful to use if paths and derivations needed explicit conversion). Problem is probably solved by giving a canonical name to the types of coercion or conversion (the C++ Nix code calls both coercion, in the case of |
I would argue that the current behavior of Path types vs. strings encode a fundamental difference in how the information is being treated (eval time vs run time, essentially), and having basic language constructs completely obliterate that difference just confuses the issue for newcomers, inviting them to make an entire class of mistakes, and annoys the experienced. |
Is your feature request related to a problem? Please describe.
toString exp
and"${exp}"
behave differently.Only the first three work with string interpolation, but not e.g.
"${1}"
or"${true}"
.Describe the solution you'd like
The following should work:
"${1}"
"${[ 1 /foo/bar true ]}"
"${true}"
"${false}"
"${null}"
Describe alternatives you've considered
Make
toString
work on fewer things, to make the features converge consistency, but that would break existing code or require a deprecation strategy.Additional context
It's not clear why these differences even exist, except that string interpolation on paths serves a different purpose than for the other data types.
The text was updated successfully, but these errors were encountered: