-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
In the Nix language, + associates in such a way that path + "/" + "foo" evaluates to path + "foo" for any path value path.
#6530 pushes people towards this syntax, so perhaps it's worth considering to give them a concise alternative that doesn't lead to almost inexplicable malformed paths every now and then.
Describe the solution you'd like
Instead of
nix-repl> "a" / "b"
error: value is a string while a float was expected
nix-repl> ./. / "b"
error: value is a string while a float was expected
evaluate to
nix-repl> "a" / "b"
"a/b"
nix-repl> ./. / "b"
/home/user/src/nixpkgs/b # assuming such a ./.
Describe alternatives you've considered
Add builtin fetchers to the string context, and add fixed-size holes to strings, so that "${fetchTree foo}/bar" does not immediately fetch the tree.
Holes are a lot to ask though.
Perhaps better phrased as a "rope" of strings and lazy tree thunks. A rope, or lazily concatenated string representation might not be a bad idea?
Additional context