In nix repl, I know why f: f
outputs "<lambda>"
. But why f:f
outputs "f:f"
?
Nix treats a string of form foo:bar
as an unquoted URI literal, a simpler instance of something like https://example.com
.
nix-repl> https://example.com
"https://example.com"
The Nix reference manual says this in the section about string literals:
Finally, as a convenience, URIs as defined in appendix B of RFC 2396 can be written as is, without quotes. For instance, the string
"http://example.org/foo.tar.bz2"
can also be written ashttp://example.org/foo.tar.bz2
.
This is widely considered a misfeature. In fact, nix.dev recommends against it, there is an accepted RFC deprecating this, and both Nixpkgs and ofborg run package evaluations with this feature turned off. The Lix fork of the interpreter has also deprecated URI literals.