-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Scoping is unintuitive #490
Comments
This is by design IIRC because of some laziness-related properties. (I do agree it's counter-intuitive.) Laziness above refers to evaluation and not the implementors ;-) |
This is by design. It makes most lookups in the presence of |
😦 😦 😦 |
Ah, so |
Is there any action to do here? |
No, we can't change the with scoping rules at this point. And anyway, it would be a bad idea. See here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with#Ambiguity_contra |
Well, that's more of an argument against having/using let lib = something.very.long; in { lib.foo /*etc..*/ } and do it without the scoping ambiguities. Anyway, changing behavior of any currently valid code would need strong arguments. |
No, the Javascript example:
is not a problem with Nix's scoping rules, because |
Using |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/removing-most-uses-of-top-level-with/41233/1 |
Provide diagnostic mentioned in NixOS/nix#490 ![image](https://github.com/nix-community/nixd/assets/36667224/4db9ed38-e07e-4dc3-b3e5-9d5943aaa880)
Is this by design? It seems weird.
Contrarily,
let a = "outer"; in let a = "inner"; in a
returns"inner"
.The text was updated successfully, but these errors were encountered: