5 ms·
IMHO, Nix needs a static type checker far more than it needs parenthesis or syntactic abstraction. The syntax of Nix is a non-issue.
by willtim 10y ago
IMHO, Nix needs a static type checker far more than it needs parenthesis or syntactic abstraction. The syntax of Nix is a non-issue.
- dbcurtis 10y agoAfter a quick look at Nix syntax, it seems to me that it is almost JSON but different enough to required all new parsers. Maybe I'm wrong about that. But... why not just use JSON?
- davexunit 10y agoJSON isn't a programming language.
- dbcurtis 10y agoTrue enough. Maybe I've not seen enough of what is in a Nix packaging script.
- Ericson2314 10y agoNix is isomorphic to JSON + lambda + let-rec, made lazy.
- vertex-four 10y agoNix is actually a purely function programming language - you can embed function calls in it. This is used to great effect in various parts of nixpkgs - the entire thing is actually a program which returns the Nix package tree (but is not fully evaluated unless you explicitly ask for it).
- dbcurtis 10y agoOK, I replace my naive question above with a different naive question: "Why not just use Haskell?"
- vertex-four 10y agoHaskell is honestly a larger language, and is a pain in the butt to write. If you're just writing configuration or a very simple package, Nix is basically "JSON with colons, multiline strings, and function calls". Haskell doesn't have a reasonable built-in syntax for dictionaries/maps/whatever you want to call them, which is 95% of Nix.
- seagreen 10y agoWell, you would use records, but records are a weak point of the Haskell language. I've discussed "why not Haskell" with some Nix people and they specifically mentioned the lack of row polymorphism.
- vertex-four 10y agoYou couldn't reasonably create a record for the NixOS configuration - the amount of options (fields) is massive. The all-packages.nix file is an untyped dictionary mapping strings to derivations as well.
- codygman 10y agoPurescript?
- benley 10y agoCan I just point out that pretty much all of these options, including guix, are things that were invented well _after_ nix was established as its own thing? (aside from Haskell and Scheme themselves, of course)
- seagreen 10y agoI don't think you need to worry, I'm sure that who's familiar with PureScript also knows it's more recent than Nix. Those PureScript records tho...
- chriswarbo 10y agoYou can use `builtins.toJSON` and `builtins.fromJSON` to inter-operate with JSON. They don't handle functions or infinite datastructures though.
- qwertyuiop924 10y agoI understand, but guix works well enough, and I don't want to learn another PL just to do package managemnt. Then again, I guess that's why people use nix instead of guix.