Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
language: Explain that
with
does not shadow
Until now, both `with` and `inherit` used the wording "adds variables to the scope". But that adding happens in very different ways: `inherit` shadows, `with` does not. This is confusing, compare: let a = "outer"; attrs = { a = "inner"; b = 3; }; in (with attrs; rec { res = [a b]; }).res Result: `[ "outer" 3 ]` let a = "outer"; attrs = { a = "inner"; b = 3; }; in (rec { inherit (attrs) a b; res = [a b]; }).res Result: `[ "inner" 3 ]` This causes common packaging errors, such as: myOverlay = { zxing-cpp = callPackage ...; # the C++ package myPythonWithPackages = python.withPackages (ps: with ps; [ numpy ... zxing-cpp # Wrong: # Incorrectly refers to the C++ package, not `ps.zxing-cpp`! # Thus `import zxingcpp` fails at runtime. Thus, the explicit warning.
- Loading branch information