[Nix-dev] maximal sharing and comparisons.

Marc Weber marco-oweber at gmx.de
Sun Nov 30 00:43:07 CET 2008


> So, the evaluation of the following expression:
> 
> (__trace "bad" (__trace "good" 1)) == (__trace "bad" 1)
> 
> should only print "good" and not "bad".  If we admit the previous
> example to be correct, how should we consider this one:
> 
> let
>   tkFirst = f: s: __trace "bad tkFirst" f; /* ignore s */
> in
>   (tkFirst (__trace "good" 1) (__trace "bad args" 0)) == (tkFirst 1 0)
              ^^^^^^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^
of course these two have to be evaluated. How else should nix know that
it compares tkFirst 1 0 with tkFirst 1 0? It can only know so if the
internal representation is the same which won't be the case unlress both
__trace functions have been evaluated. Of course nix doesn't have to
evaluate tkFirst then on either side.
At least this is the best behaviour I can think of.
However I haven't seen any trouble with the current way of evaluation
myself.

Marc



More information about the nix-dev mailing list