-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
x:y is parsed as string instead of function #836
Comments
It's indeed unexpected to be a string. But I guess changing this would require a nix 2.0? |
The parsing is documented to follow RFC 2396 URIs which do allow schemes without |
Interesting. But RFC2396 even allows the following URI (if I've correctly read the BNF): |
Is there any reason for the current special parsing of URIs? With parsing paths, I get that the purpose is resolving relative paths, but that doesn't make sense for URIs. Maybe in the major version bump we can just remove it :). |
Well, yes, it's not very useful currently. It saves you quoting around the URL but in exchange you can't anti-quote, so I often (have to) use the quotes anyway. |
I'd be in favor of killing unquoted URLs in some upcoming language revision :) the fewer special cases in the language, the happier I am
|
We can always add a nixpkgs lib function or builtin to validate URIs if the need arises too. |
The reason why we have special parsing of URIs is because Nix is a DSL for describing packages, and packages descriptions almost always contain URIs, so it's convenient to have some special syntax for them. |
But I wonder what value that really gives us? I haven't seen much usage from having them as special type. |
One idea: forbid general URIs and instead require all of them to have |
I suppose that's better than status quo, but I'd really like to get rid if it all together. Could we put it to a vote or something? |
I marked this as stale due to inactivity. → More info |
I closed this issue due to inactivity. → More info |
Well, I'm not sure how it should be parsed, but I just spend quite some debugging time to find out that nix parses
x:x
not as the identity function but as the string"x:x"
; so we appearantly have to always put a space after a:
.This may be a good coding convention, but then I'd like x:y to error. If this is there to allow uris, maybe we can match for :// instead of just :
The text was updated successfully, but these errors were encountered: