[Nix-dev] args: with args
Armijn Hemel
armijn at uulug.nl
Mon Mar 10 23:36:42 CET 2008
hi all,
maybe a bit of controversy, but I'd like to talk about some of the new
syntax things that have been included recently, that are, in my opinion,
not an improvement.
I'm talking about this:
args: with args;
To be honest, it does not make me that happy. I know why it was
introduced: to avoid replication of parameters. Let's take "hello" as an
example:
In all-packages.nix it says:
hello = import ../applications/misc/hello/ex-1 {
inherit fetchurl stdenv perl;
};
The (oldskool) Nix expression for it looks like this:
{stdenv, fetchurl, perl}:
stdenv.mkDerivation {
name = "hello-2.1.1";
builder = ./builder.sh;
src = fetchurl {
url = mirror://gnu/hello/hello-2.1.1.tar.gz;
md5 = "70c9ccf9fac07f762c24f2df2290784d";
};
inherit perl;
}
The parameters fetchurl, stdenv and perl appear three times: two times
in the top level file and twice in the other Nix expression. The "args:
with args" construction would just weed out one occurence but force me
to look at the top level file to see what the parameters were again. So,
in my opinion readability (and usability) is actually reduced.
Could someone please convince me why this is an improvement?
Bigger scope: right now there are quite a few different styles that are
used to make expressions. To be honest, I'm not too happy with that
either. It looks messy and it is confusing, since it needs quite a few
brain twists on my side to see what is going on.
armijn
--
---------------------------------------------------------------------------
armijn at uulug.nl | http://www.uulug.nl/ | UULug: Utrecht Linux Users Group
---------------------------------------------------------------------------
More information about the nix-dev
mailing list