[Nix-dev] An issue regarding the default parameters of a function

Sergey Mironov grrwlf at gmail.com
Fri Feb 12 12:54:01 CET 2016


Thanks, It is clear. I would also vote for shorter code here.

Sergey

2016-02-12 14:21 GMT+03:00 Vladimír Čunát <vcunat at gmail.com>:
> Hi.
>
> On 02/12/2016 12:11 PM, Sergey Mironov wrote:
>> I have an issue regarding the combination of two Nix features:
>> default parameters ( f = {arg ? def } : ...) and arbitrary length
>> parameters (f = args@{arg, ...} : ...).
>
> @-pattern binds exactly what was *passed* to the function. Eelco
> considers that a feature IIRC. There's been a discussion about this on a
> couple of nix issues on github.
>
> Personally, I would prefer to bind the attrmap after substituting
> defaults, as that seems much more useful, but that would be a
> non-compatible change to nix...
>
> --Vladimir
>
>


More information about the nix-dev mailing list