Skip to content
  • Rebecca Turner's avatar
    abb4dcf9
    Remove `with` and `rec` · abb4dcf9
    Rebecca Turner authored
    `with` and `rec` are considered anti-patterns:
    
    - `with` makes it unclear where variables are assigned and what
      variables refer to.
    
      Instead of `with pkgs; [ foo ]`, write `[ pkgs.foo ]` directly.
    
    - `rec` also makes it unclear what variables refer to and makes it easy
      to introduce subtle bugs.
    
      Instead of `rec { a = 1; b = a; }`, use a let binding:
    
        let a = 1;
            b = a;
         in {
            inherit a b;
         }
    abb4dcf9
    Remove `with` and `rec`
    Rebecca Turner authored
    `with` and `rec` are considered anti-patterns:
    
    - `with` makes it unclear where variables are assigned and what
      variables refer to.
    
      Instead of `with pkgs; [ foo ]`, write `[ pkgs.foo ]` directly.
    
    - `rec` also makes it unclear what variables refer to and makes it easy
      to introduce subtle bugs.
    
      Instead of `rec { a = 1; b = a; }`, use a let binding:
    
        let a = 1;
            b = a;
         in {
            inherit a b;
         }
Loading