• heraplem@leminal.space
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    9 hours ago

    There are a few gnarly things about Nix, even for someone who’s familiar with Haskell (the most similar language to Nix that’s even close to mainstream).

    • Dynamic typing (you mention this briefly). Some people like the extra flexibility that dynamic typing gives, but there’s a tradeoff: more errors. The thing is, due to NixOS’s complicated structure, the traceback for an evaluation error might not give you any information about where the cause is (indeed, the traceback might not include a single line of your own code!). This makes errors unusually costly in NixOS specifically, so any language feature that causes more runtime errors automatically has a worse impact than it would in a more “normal” language.
    • The “standard library” (builtins) is extremely sparse. You basically have to depend on at least nixpkgs-lib if you want to get any real work done.
    • No real data abstraction mechanisms. No ADTs, no nominal types. The only composite types are attrsets and lists. The usual way to encode a custom type is as an attrset with a _type field or some such.
    • While we’re at it, very limited pattern-matching.
    • Clunky list literal syntax: no commas between list elements. I can’t tell you the number of times I’ve forgotten to surround list elements in parentheses.
    • Can anyone remember the rules for escaping ${ or ''? I have to look them up every time.