[Nix-dev] @ and default arguments

Marc Weber marco-oweber at gmx.de
Fri Aug 27 13:11:06 CEST 2010


Excerpts from Eelco Dolstra's message of Fri Aug 27 13:03:28 +0200 2010:
> Hi,
> 
> On 08/25/2010 11:36 PM, Yury G. Kudryashov wrote:
> 
> > The following returns false:
> > 
> > (a@{ b ? true }: a ? b) { }
> > 
> > It seems that after a@{...} a is not populated by default values. Is it a 
> > bug, or a feature?
> 
> This is the intended behaviour.  The fact that there is a "{b ? true}" does not
> cause an attribute to be "added" to the passed argument set ("a"), it merely
> causes a "b" with value "true" to be added to the lexical scope.
 
So let's rephrase: Does it make sense to think about a way to add the
default values to an attr set in that case so that you can pass the
attrs over to another function without duplicating default values?

Yury, its time to talk about your use case.

Marc Weber



More information about the nix-dev mailing list