2 ms·
> The naming is very odd (e.g. why "sets" for dicts / records), and then it manages to make the language incompatible with itself by having attribute sets for v
by anon291 4y ago
> The naming is very odd (e.g. why "sets" for dicts / records), and then it manages to make the language incompatible with itself by having attribute sets for values and a completely different syntax for attribute set parameters, no doubt because the language was ambiguous due to the lack of function prefix (also makes curried functions awkward).
It's not sets... It's attrsets, and the naming of the construct doesn't matter. I'm not sure I called them anything until I looked it up just now.
As for syntax... I'm not sure what you're referring to. Pattern syntax and construction syntax are different in every functional language I know.
> XSLT is also a functional language. That doesn't make it not-awful.
You're thinking of XQuery I think
Nix broadly borrows exactly everything from the lambda calculus, with no change in terminology. It introduces records, which is kind of necessary for any serious programming. It adopts standard conventions for records (curly braces and an equal sign). The only 'surprising' bit of syntax is the lambda construct, but this is such a minor thing it's almost silly to complain about it. I honestly don't understand what is surprising about the nix language.
Nixpkgs... sure I can see that, and I actually agree that types would be nice. Or at least interfaces. But the nix language as a whole is pretty straightforward.
- masklinn 4y ago> It's not sets... It's attrsets You may want to tell, er, the official website? https://nixos.org/manual/nix/stable/language/index.html https://nixos.org/manual/nix/stable/language/index.html > { x = 1; y = 2; } A set with attributes named x and y > and the naming of the construct doesn't matter. It absolutely matters when you're trying to learn the language and the naming of concepts is nonsensical. > Pattern syntax and construction syntax are different in every functional language I know. So you don't know Haskell? -- construction example = Person { name = "John Doe", admin = True } -- pattern render Person { name = name, admin = admin } = name ++ suffix where suffix = if admin then " - Admin" else "" or OCaml? (* construction *) let initial_state = { lcd=0; lka=Equals; loa=Equals; vpr=0 } ;; (* pattern *) match s with | { lcd = a; vpr = d; _ } -> (* Expression *) or Rust? // construction let p = Point { x: 0, y: 7 }; // pattern let Point { x: a, y: b } = p; All three have punning (as an extension for Haskell) so you can skip the explicit rebinding, but that's not what Nix does, as far as I can tell it doesn't have punning on the construction side, doesn't have full syntax on the pattern side, and the syntaxes are just similar enough to be annoying: # construction { x = 1; y = 2; } # pattern { x, y }: x + y > You're thinking of XQuery I think No, I am not. > I honestly don't understand what is surprising about the nix language. I can only assume that's Stockholm syndrome given I literally just went through https://nixos.org/manual/nix/stable/language/index.html https://nixos.org/manual/nix/stable/language/index.html and found the inconsistencies listed above, also that @ patterns can go on either side (why?), or the existence of "with" (though I guess in a functional and pure language it's not as bad as it is in good ol javascript with which it shares this great feature). And it's not that it's "surprising", it's just that it's... sloppy. Sub-par. And definitely not "intuitive". Even less so when a pair of single quotes is equivalent to a double quote (except not), rather than either an empty string (or at least something string-like), or an error. To say nothing of the escaping scheme inside those string literals.
- zaphar 4y agoNo,he is correct when he says XSLT. It's a pure functional language with a terrible syntax. Nix as a language is fine. There isn't actually much to it. However the extreme approach to laziness while quite powerful also means you can't actually follow the flow of a package. It's manifests as come from programming since with stuff in packages with no reference in yours messing with your own packages internals. It is possible to tease it out and after a while you sort of know where stuff is probably coming from. But even for someone who is pretty comfortable with Haskell and other poster children for FP, nix is a challenge to reason about code locally.