News for hackers. Stuff that matters.
Re:Typing Nix by mbrock on Friday June 23, 2017 @10:24AM (#14619338)
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 separators between items instead of after each one; in Nix each item can always be moved without messing with separators.

I think Nix is an engineering marvel up to and including the language design. If you can make a better surface syntax and demonstrate it by translating some significant part of Nixpkgs, I'd be very interested, but I think in general the language is the way it is because that's what made most sense for the system's designers.

Re:Typing Nix by codemac on Friday June 23, 2017 @11:44AM (#14619975)
> If you can make a better surface syntax

... http://gnu.org/s/guix

Lisp is pretty good at lists.

The only important language is the derivation language sent to the daemon. Nix spends so much time building up inputs... for shell scripts. I always felt like they would have been so much more successful if they chose some other, more popular language to generate derivation.

Re:Typing Nix by mbrock on Friday June 23, 2017 @01:11PM (#14620814)
I dig Guix, but Lisp is also one of the most commonly reviled syntaxes, so it's hard to say it's clearly better, or that Nix would enjoy more adoption with S-expressions.
Re:Typing Nix by wcummings on Sunday June 25, 2017 @11:49AM (#14630560)
Reviled by people who have never used it.
Re:Typing Nix by gkya on Friday June 23, 2017 @02:18PM (#14621394)
Most commonly and with lots ans lots of prejudice.
Re:Typing Nix by jancsika on Friday June 23, 2017 @06:47PM (#14623343)
Is it possible to write a guix package that includes code which redefines the package object?
Re:Typing Nix by codemac on Wednesday June 28, 2017 @06:39PM (#14659169)
Yes!

http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/...

You'll see here that the package emacs-minimal actually inherits from the emacs package definition, and then all fields afterwards are essentially overwrites of whatever was in the emacs package.

Unfortunately, I just noticed that the manual alludes to this, but actually never explicitly documents it in the "Defining Packages" section :/

Re:Typing Nix by KirinDave on Tuesday June 27, 2017 @11:32AM (#14646319)
> Neither SML nor Haskell are optimized for expressing deeply nested records with many string literals, for example.

Purescript's extensible row types handle this process elegantly and if Nix takes a cue from that, it will work great.

Re:Typing Nix by qznc on Friday June 23, 2017 @02:16PM (#14621385)
So, JavaScript? The records literals are JSON, which is the most popular syntax for this at the moment anyways.
Re:Typing Nix by cwp on Friday June 23, 2017 @02:44PM (#14621641)
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 syntactically, and more pleasant to write.
Re:Typing Nix by mbrock on Friday June 23, 2017 @02:57PM (#14621764)
Also, recursive definitions using "rec" which become nasty in JavaScript.
Re:Typing Nix by mbrock on Friday June 23, 2017 @02:34PM (#14621528)
I tend to write JavaScript that looks a bit like Nix... but in general, the imperative constructs aren't suitable to the lazy evaluation strategy of Nix.