I love Nix. NixOS is my primary development operating system. However, the Nix language itself is syntactically ugly , and this proposal makes it even uglier. Parentheses, sigils and special characters (esp. semicolons) are line noise — the less of it the better. Why they wouldn't take the most (syntactically) beautiful functional programming language out there — Standard ML? It would work perfectly for such a task.…
Typing Nix
81–90 of 128 posts
Re: Typing Nix
#82Earlier quoted context omitted.
I love the Nix language and I generally distrust aesthetic feelings about programming languages. Neither SML nor Haskell are optimized for expressing deeply nested records with many string literals, for example. The multiline interpolated strings in Nix are extremely much better than in SML or Haskell. The way records and arrays are written is great: SML and Haskell both suffer from the tedious problem of using separ…
So, JavaScript? The records literals are JSON, which is the most popular syntax for this at the moment anyways.
Re: Typing Nix
#83Earlier quoted context omitted.
I love the Nix language and I generally distrust aesthetic feelings about programming languages. Neither SML nor Haskell are optimized for expressing deeply nested records with many string literals, for example. The multiline interpolated strings in Nix are extremely much better than in SML or Haskell. The way records and arrays are written is great: SML and Haskell both suffer from the tedious problem of using separ…
So, JavaScript? The records literals are JSON, which is the most popular syntax for this at the moment anyways.
let
foo = 42;
bar = "a string";
in {
baz = "deja";
quux = "vu";
}
Javascript: const foo = 42;
const bar = "a string";
return {
baz: "similar",
quux: "but different"
};
You find this kind of thing all over the place. Nix is a much smaller and simpler language syntactically, and more pleasant to write.Re: Typing Nix
#84Earlier quoted context omitted.
I could not agree with you more! I use nix daily, and every time I go to edit it a nix file a voice in the back of my head says, "you should really start that Haskell to Nix compiler you've been thinking about." [edit] ha! just notice the next comment talking about hnix. Great minds... :)
Wow, I'm doing the opposite where I'm staring at all these other DSLs and configuration files and have to hold myself back from writing a bunch of nix to autogenerate them from.
Re: Typing Nix
#85Earlier quoted context omitted.
So, JavaScript? The records literals are JSON, which is the most popular syntax for this at the moment anyways.
No, Nix syntax is much nicer than Javascript. Consider, for example, the similarity between a let expression and an attribute set (NOT JSON by the way): let foo = 42; bar = "a string"; in { baz = "deja"; quux = "vu"; } Javascript: const foo = 42; const bar = "a string"; return { baz: "similar", quux: "but different" }; You find this kind of thing all over the place. Nix is a much smaller and simpler language syntacti…
Re: Typing Nix
#86Re: Typing Nix
#87Earlier quoted context omitted.
> comma-first syntax oooh but this is one of those trivial things that I really liked in my brief days of using Haskell, and that has sometimes carried over to my C++, e.g. in initializer lists. I find it super useful because everything lines up nicely, and from the point of view of version control you don't have to edit the previous line to change '}' to ',' when adding a new line.
Go solves this problem by permitting foo := Foo{ x: 10, y: 24, }
Re: Typing Nix
#88Earlier quoted context omitted.
> comma-first syntax oooh but this is one of those trivial things that I really liked in my brief days of using Haskell, and that has sometimes carried over to my C++, e.g. in initializer lists. I find it super useful because everything lines up nicely, and from the point of view of version control you don't have to edit the previous line to change '}' to ',' when adding a new line.
Go solves this problem by permitting foo := Foo{ x: 10, y: 24, }