[Nix-dev] maximal sharing and comparisons.

Nicolas Pierron nicolas.b.pierron at gmail.com
Sun Nov 23 13:34:09 CET 2008


On Sun, Nov 23, 2008 at 12:35, Michael Raskin <7c6f434c at mail.ru> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Nicolas Pierron wrote:
>> Hi,
>>
>> I have a problem with the NixOS implementation.  I have remarked the
>> following problem:
>>
>> let
>>   v = {foo=true;bar=false;};
>>   a = builtins.trace v v;
>>   b = a;
>> in
>>   assert a == b; true
>>
>> where "v" is printed.  "v" should not be printed because unprocessed
>> values of "a" and "b" are identical.  Therefore the assertion should
>> succeed without evaluating "a" and "b".
>
> Well, exactly this case (where you could get something for nothing) is
> rare. Evaluation uses normal form cache. The only side-effects in the
> language are output and creating derivations (neither of them actually
> creates any problems for the paths intended to be built). So, I do not
> see why it is a problem..

This is a problem because in uniqFlattenAttr, the comparison is used
to remove duplicated element (loaded twice or more), the problem is
that elements cannot be defined until you have completed the list of
unique elements.  The only solution that I can see here is to enable
this kind of comparison.  I think this is possible as this have been
done in Stratego (which also use ATerm).

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
- If you are doing something twice then you should try to do it once.



More information about the nix-dev mailing list