> Nix-the-language is the worst programming language I've ever had the misfortune to interact with.
I feel the same.
The multi-line strings and string interpolation are both really nice. Unfortunately a lot of the text being munged is bash and usually already ugly, so the result is double-ugly.
The functional aspects are okay. However, as an expression language and being primarily used in a declarative way, it is frequent to have almost no idea what's going on in Nix. Reading the code and understanding the evaluation are extremely far apart.
callPackage... It's something I thought would be cool in a language until I actually experienced the depth of disorientation it can cause.
The remaining syntax has a lot of "but why?" where it just seems to do its own thing relative to other languages, which makes it harder to get into a rhythm.
Some of the subject matter is the real culprit. The cross compiling sliding window thing... I've studied it several times. If I had to actually do something with it, straight to the LLM. Compilers have targets.
So I found some LLMs are wonderful at Nix. A few times I just prompted "port this <github link>" and got a pull request with nix package exactly how I would have written it. One time even manager to implement multiple missing dependencies as well.
> The remaining syntax has a lot of "but why?" where it just seems to do its own thing relative to other languages
Like what?
My list of Nix language nits is relatively small, would like to understand.
One thing that seems under-developed is smart merging. There is // at language level, but then if you want datatype-specific merging, you use functions. That itself is just the power of functional programming. But as it is with untyped languages, you end up doing the same thing slightly different in several places, and a fractal of accidental complexity starts to appear.
I've heard people say "JSON with functions", but I think this is much too generous.
- Functions can be called without delimiters
- AttrSets have lots of delimiting, very explicit syntax
- Lists have absolutely no delimiters again
foo 1 2 is a function call, right?
So if I need it in a list, I can just write: [ foo 1 2 ] right?
Note, we pathologically put spaces around lists in Nix because we are subconsciously sure that something is about to bite us.
[ foo 1 2 ] is a list of three elements, not a function call.
I forget which terrible thing I was doing, but I had a variation of this syntax trap in my code after naively moving the expression into a list. The error message was, as usual, from the Turtles in Time dimension.
The mixture of super explicit and implicit delimiting as well as borrowed ideas like \\ and invented ideas like with and import just make Nix feel like it's all over the place, inconsistent, and doing its own thing when we already had a lot of functional languages to work with.
The evaluation model is completely appropriate for the problem yet pretty unique in programming generally. It has a lot of new ideas that throw even seasoned people well off track. Each new idea is not much, but they compound into not having any idea what we're looking at and watching 50k nixpkgs evaluate just fine while not being able to read any of that code at all.
I'd prefer something like Haskell, Lisp, or Clojure, but please just one. Using Scheme in Guile is a great choice. It's so much easier to read. Hopefully the macros can be developed to bring the best of lazy evaluation into Scheme and fix the runtime issues.
Nix function call syntax is completely standard for ML-style functional languages and allows for effortless partial application. The main downside is that error messages can get cryptic, especially so when Nix is untyped.
Whitespace add list delimiter is not very common, but I have to admit I really like it.
I was hoping for some “this doesn’t work” kind of things, not “this doesn’t feel familiar”.
Not sure how Nix doesn’t win the readability contest: literally a config file with function calls, and as little superfluous syntax as possible. I’d say the real criticism is: Nix is hard to write, and nixpkgs idioms (nested, undocumentedabstractions scattered throughout the code) are hard to read.
A system's purpose is what it does. Nix the language is used to generate bash scripts that are then run in a sandbox, and based on what I'm seeing it's not a great fit/architecture.
(Nix is not a general-purpose language. The concept of store paths etc is hardcoded in it.)
I can complain about the horrible, undebuggable, error messages on the slightest typos too, if you want? Nix is way too subtle to "win the readability contest".
I feel the same.
The multi-line strings and string interpolation are both really nice. Unfortunately a lot of the text being munged is bash and usually already ugly, so the result is double-ugly.
The functional aspects are okay. However, as an expression language and being primarily used in a declarative way, it is frequent to have almost no idea what's going on in Nix. Reading the code and understanding the evaluation are extremely far apart.
callPackage... It's something I thought would be cool in a language until I actually experienced the depth of disorientation it can cause.
The remaining syntax has a lot of "but why?" where it just seems to do its own thing relative to other languages, which makes it harder to get into a rhythm.
Some of the subject matter is the real culprit. The cross compiling sliding window thing... I've studied it several times. If I had to actually do something with it, straight to the LLM. Compilers have targets.